package com.ygxsk.carhome.ui.signature;

import android.annotation.SuppressLint;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RadioGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.afollestad.materialdialogs.GravityEnum;
import com.afollestad.materialdialogs.MaterialDialog;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.arialyy.annotations.Download;
import com.arialyy.aria.core.Aria;
import com.arialyy.aria.core.task.DownloadTask;
import com.arialyy.aria.util.ALog;
import com.blankj.utilcode.util.ActivityUtils;
import com.blankj.utilcode.util.AppUtils;
import com.blankj.utilcode.util.ClickUtils;
import com.blankj.utilcode.util.ColorUtils;
import com.blankj.utilcode.util.FileUtils;
import com.blankj.utilcode.util.KeyboardUtils;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.NetworkUtils;
import com.blankj.utilcode.util.PathUtils;
import com.blankj.utilcode.util.StringUtils;
import com.blankj.utilcode.util.TimeUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemChildClickListener;
import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.flyco.roundview.RoundTextView;
import com.gyf.immersionbar.ImmersionBar;
import com.hjq.permissions.OnPermissionCallback;
import com.hjq.permissions.XXPermissions;
import com.hjq.toast.Toaster;
import com.kathline.library.content.ZFileConfiguration;
import com.kathline.library.content.ZFileContent;
import com.kongzue.dialogx.dialogs.PopTip;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.util.SmartGlideImageLoader;
import com.scwang.smart.refresh.layout.SmartRefreshLayout;
import com.scwang.smart.refresh.layout.api.RefreshLayout;
import com.scwang.smart.refresh.layout.listener.OnRefreshListener;
import com.trello.rxlifecycle4.android.ActivityEvent;
import com.yanzhenjie.permission.AndPermission;
import com.yanzhenjie.permission.runtime.Permission;
import com.ygxsk.carhome.R;
import com.ygxsk.carhome.alertview.AlertView;
import com.ygxsk.carhome.constant.ConstantApi;
import com.ygxsk.carhome.constant.ConstantSign;
import com.ygxsk.carhome.constant.ExtraKey;
import com.ygxsk.carhome.constant.ExtraValue;
import com.ygxsk.carhome.enumwrap.FileSignatureBoxStatus;
import com.ygxsk.carhome.enumwrap.SignatureClientType;
import com.ygxsk.carhome.enumwrap.SignatureVehicleType;
import com.ygxsk.carhome.event.EventSignatureDetail;
import com.ygxsk.carhome.event.EventSignatureMain;
import com.ygxsk.carhome.listener.AuthorityCallbackListener;
import com.ygxsk.carhome.listener.ErrorParentExtraSingle;
import com.ygxsk.carhome.permission.PermissionSetting;
import com.ygxsk.carhome.permission.RuntimeRationale;
import com.ygxsk.carhome.response.FileSignatureAgreement;
import com.ygxsk.carhome.response.FileSignatureManage;
import com.ygxsk.carhome.retrofit.AddLogUpLoadInfo;
import com.ygxsk.carhome.retrofit.ApiException;
import com.ygxsk.carhome.retrofit.ApiRequestSubListener;
import com.ygxsk.carhome.retrofit.ApiService;
import com.ygxsk.carhome.retrofit.ErrorConsumer;
import com.ygxsk.carhome.retrofit.NetworkManager;
import com.ygxsk.carhome.retrofit.ResponseTransformer;
import com.ygxsk.carhome.sys.PermissionInterceptor;
import com.ygxsk.carhome.sys.PermissionNameConvert;
import com.ygxsk.carhome.ui.ErrorActivity;
import com.ygxsk.carhome.ui.adapter.FileSignatureAgreementAdapter;
import com.ygxsk.carhome.utils.CommUtils;
import com.ygxsk.carhome.utils.ViewUitls;
import com.ygxsk.carhome.views.ClearEditText;
import com.ygxsk.carhome.views.MyLinearLayoutManager;
import com.ygxsk.integrated.retrofit.Parameterkey;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import butterknife.BindView;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.functions.Consumer;
import okhttp3.MediaType;
import okhttp3.RequestBody;

/*
 * @Author:itchenqi175@163.com
 * @Time:2023-10-26  11:31
 * @Description:合同签约的详情
 */
public class SignatureDetailActivity extends ErrorActivity implements ErrorParentExtraSingle {

    //外侧包裹一个下拉刷新，可能停留一段时候状态变动，或者可能直接就在详情内查看；
    @BindView(R.id.refreshLayoutInSignatureDetail)
    SmartRefreshLayout refreshLayoutInSignatureDetail;

    @BindView(R.id.recyclerViewInSignatureDetail)
    RecyclerView recyclerViewInSignatureDetail;

    //重新添加签约按钮
    @BindView(R.id.layoutbuttoncreatesignatureagain)
    RoundTextView layoutButtonCreateSignatureAgain;

    //签约时间
//    @BindView(R.id.textviewfilesigncreatetimedetail)
    TextView textViewFileSignCreateTimeDetail;

    //档案编号
//    @BindView(R.id.textviewfilesignaturedetail)
    TextView textViewFileSignatureDetail;

    //模板名称
//    @BindView(R.id.textViewFileSignTemplateNameDetail)
    TextView textViewFileSignTemplateNameDetail;

    //乙方名称
//    @BindView(R.id.textViewFileSignPartyBNameDetail)
    TextView textViewFileSignPartyBNameDetail;

    //乙方电话
//    @BindView(R.id.textViewFileSignPartyBPhoneDetail)
    TextView textViewFileSignPartyBPhoneDetail;

    //合同状态
//    @BindView(R.id.textViewFileSignContractStatusDetail)
    TextView textViewFileSignContractStatusDetail;


    //标志从哪个界面过来，用于详情底部按钮的判断；
    private int extra_jumpfrom_where;

    private FileSignatureManage extra_fileSignatureManage;

    //填充适配器
    private FileSignatureAgreementAdapter fileSignatureAgreementAdapter;

    //整个列表适配器
    private ArrayList<FileSignatureAgreement> mDataResources = new ArrayList<>();

    private MaterialDialog materialDialogCustomView;

    //该下载apk任务的任务id值内容；
    private long taskDownLoadApkId;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mActivityInstance = this;

        processExtraData();

        initloading();

        initViews();

        gainDatas();


        if (!EventBus.getDefault().isRegistered(this)) {
            EventBus.getDefault().register(this);
        }

        //注册一个下载,主要是下载二维码的图片内容
        Aria.download(this).register();

    }

    @Override
    protected int getContentViewId() {
        return R.layout.activity_signature_detail;
    }

    @Override
    protected void initImmersionBar() {
        super.initImmersionBar();

        ImmersionBar.with(this)//
                .titleBar(R.id.toolbarygxskout)
                .fitsSystemWindows(true)//解决状态栏和布局重叠问题，任选其一，默认为false，当为true时一定要指定statusBarColor()，不然状态栏为透明色，还有一些重载方法
                //.statusBarColor(R.color.colorPrimary)//
                //.navigationBarColor(R.color.colorPrimary)//
                //.keyboardEnable(true)
                .init();
    }

    @Override
    protected void initToolBar(ToolbarHelper toolbarHelper) {

        toolbarHelper.setTitle(getString(R.string.title_signature_issue));
        toolbarHelper.setVersionName(true, AppUtils.getAppVersionName());
        toolbarHelper.setLayoutClose(false, "", null);

        toolbarHelper.setLayoutLeft(true, R.drawable.backicon, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //搜索客户信息，优先关闭软键盘
                KeyboardUtils.hideSoftInput(mActivityInstance);
                methodBack();
            }
        });

        toolbarHelper.setLayoutRight(false, 0, "", null);

//        toolbarHelper.setLayoutRight(true, 1, "历史记录", new ClickUtils.OnDebouncingClickListener() {
//            @Override
//            public void onDebouncingClick(View v) {
//
//                //这个也是更多，跳转到选项卡列表页，携带搜索？
//                Bundle extra_bundle = new Bundle();
//                //这里的更多是单个人的更多？还是包裹所有人的？
////                ActivityUtils.startActivity(SmartGoOutActivity.this, CardDistHistoryActivity.class);
////                ActivityUtils.startActivity(SmartGoOutActivity.this, SmartGoRecordHistoryActivity.class);
//                ActivityUtils.startActivity(SmartGoOutActivity.this, SmartGoSumHistoryActivity.class);
//
//            }
//        });

    }

    @Override
    protected void onClickNodata(View v) {

        gainDatas();

    }

    @Override
    protected void initViews() {

        recyclerViewInSignatureDetail.setLayoutManager(new MyLinearLayoutManager(this));
        fileSignatureAgreementAdapter = new FileSignatureAgreementAdapter(R.layout.signaturedetailadapter, mDataResources, ExtraValue.VALUE_JUMPFROM_SIGNATURE_ACTIVITY_ONITEM_CLICK_INTO);
        recyclerViewInSignatureDetail.setAdapter(fileSignatureAgreementAdapter);

        //设置header
        fileSignatureAgreementAdapter.addHeaderView(getHeaderView(recyclerViewInSignatureDetail));
        fileSignatureAgreementAdapter.notifyDataSetChanged();

        //点击 直接是 合同的  预览
        fileSignatureAgreementAdapter.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(@NonNull BaseQuickAdapter<?, ?> adapter, @NonNull View view, int position) {

                FileSignatureAgreement fileSignatureAgreement = (FileSignatureAgreement) adapter.getItem(position);

                if (fileSignatureAgreement != null) {

                    //预览的逻辑通用；
                    gain_getSignTaskPreviewUrl(fileSignatureAgreement);

                }

            }
        });

//        //条目之中的 单独的 点击按钮事件；
        fileSignatureAgreementAdapter.setOnItemChildClickListener(new OnItemChildClickListener() {
            @Override
            public void onItemChildClick(@NonNull BaseQuickAdapter<?, ?> adapter, @NonNull View view, int position) {

                FileSignatureAgreement fileSignatureAgreement = (FileSignatureAgreement) adapter.getItem(position);

                if (fileSignatureAgreement != null) {

                    switch (view.getId()) {

//                        case R.id.textViewFileSignPartyBPhone: {//拨打客户手机号
//
//                            clickButton_toCallPhone(SignatureDetailActivity.this, fileSignatureAgreement.getClientPhone(), CallHistoryBusinessType.BUSINESSTYPE_7.getIndex());
//
//                            break;
//                        }

                        case R.id.roundTextViewButton_signature_continue: {//填写中，继续填写，调起链接

                            gain_resumeOwnerSignUrl(fileSignatureAgreement);

                            break;
                        }

                        case R.id.roundTextViewButton_signature_qrcode: {//销售员--或者销售员发起签署链接 给用户的手机，用户用浏览器或者微信扫码填写；生成签署二维码

                            //默认是生成客户签署二维码。优先展示二维码，
                            gain_getFascActorQr(fileSignatureAgreement, false, null);

                            break;
                        }

//                        case R.id.roundTextViewButton_signature_edit: {//销售员--填写  档案信息，主要是提价合同模板 和选择领导审批人和确认是哪个合同
//                            method_edit_addSubmit(fileSignatureAgreement);
//                            break;
//                        }

                        case R.id.roundTextViewButton_signature_preview_two: {//销售员 预览

                            gain_getSignTaskPreviewUrl(fileSignatureAgreement);

                            break;
                        }


                        case R.id.roundTextViewButton_signature_cancel: {//销售员--作废这条合同

                            method_handler_button_cancel(fileSignatureAgreement);

                            break;
                        }

                        case R.id.roundTextViewButton_signature_permission: {//销售员--给领导通知一下，发起签署审批

//                            String informationId = fileSignatureManage.getInformationId();

                            CommUtils.checkDialog(mAlertView);

//                            mAlertView = new AlertView(StringUtils.getString(R.string.clearaddorsubmitsuretitletips), //提示
//                                    getString(R.string.signature_send_current_permission),//确定给领导发起电子审批，确认签署审批，领导审批后才可以正式签署。
//                                    StringUtils.getString(R.string.clearcachecancel), //取消
//                                    new String[]{StringUtils.getString(R.string.clearcachetitlesure)},//确定
//                                    null, mActivityInstance, AlertView.Style.Alert, new com.ygxsk.carhome.alertview.OnItemClickListener() {//
//                                @Override
//                                public void onItemClick(Object o, int position) {
//
//                                    if (position != AlertView.CANCELPOSITION) {
//
//                                        gain_noticeManager(fileSignatureAgreement);
//
//                                    }
//
//                                }
//                            });
//
//                            mAlertView.setCancelable(true);
//                            mAlertView.show();

                            mAlertView = new AlertView("提交审批申请", //提示
                                    "请确认合同无误，并且填写完毕，提交后将会通知领导进行审批定稿，请问是否提交？",//确定给领导发起电子审批，确认签署审批，领导审批后才可以正式签署。
                                    StringUtils.getString(R.string.clearcachecancel), //取消
                                    new String[]{StringUtils.getString(R.string.clearcachetitlesure)},//确定
                                    null, mActivityInstance, AlertView.Style.Alert, new com.ygxsk.carhome.alertview.OnItemClickListener() {//
                                @Override
                                public void onItemClick(Object o, int position) {

                                    if (position != AlertView.CANCELPOSITION) {

                                        gain_noticeManager(fileSignatureAgreement);

                                    }

                                }
                            });

                            mAlertView.setCancelable(true);
                            mAlertView.show();

                            break;
                        }


                        //管理层的内容-------------------------------------------------------------------------------------------------
//                        case R.id.roundTextViewButton_signature_edit_manager: {//管理层-填写，管理层也能签署合同，只是没有发起审批那一步；
//
//                            //以这里做提交入口
//                            Bundle extra_bundle = new Bundle();
//                            //携带这条信息过去，有一些初始化值，到下一个界面；
//                            extra_bundle.putParcelable(ExtraKey.EXTRA_SIGNATURE_FILESIGNATURE_AGREEMENT, fileSignatureAgreement);
//                            ActivityUtils.startActivity(extra_bundle, SignatureAddSubmitToActivity.class);
//
//                            break;
//                        }

                        case R.id.roundTextViewButton_signature_sure_manager: {//管理层-确认发起电子合同

                            CommUtils.checkDialog(mAlertView);

//                            mAlertView = new AlertView(StringUtils.getString(R.string.clearaddorsubmitsuretitletips), //提示
//                                    getString(R.string.signature_send_signature_sure_manager),//管理层，确认允许员工签署该合同，确认并发起审批
//                                    StringUtils.getString(R.string.clearcachecancel), //取消
//                                    new String[]{StringUtils.getString(R.string.clearcachetitlesure)},//确定
//                                    null, mActivityInstance, AlertView.Style.Alert, new com.ygxsk.carhome.alertview.OnItemClickListener() {//
//                                @Override
//                                public void onItemClick(Object o, int position) {
//
//                                    if (position != AlertView.CANCELPOSITION) {
//
//                                        gain_confirmLaunch(fileSignatureAgreement);
//
//                                    }
//
//                                }
//                            });
//
//                            mAlertView.setCancelable(true);
//                            mAlertView.show();

                            mAlertView = new AlertView("提交定稿", //提示
                                    "请确认合同无误，一旦发起将无法修改合同内容，请谨慎操作！请问是否提交？",//管理层，确认允许员工签署该合同，确认并发起审批
                                    StringUtils.getString(R.string.clearcachecancel), //取消
                                    new String[]{StringUtils.getString(R.string.clearcachetitlesure)},//确定
                                    null, mActivityInstance, AlertView.Style.Alert, new com.ygxsk.carhome.alertview.OnItemClickListener() {//
                                @Override
                                public void onItemClick(Object o, int position) {

                                    if (position != AlertView.CANCELPOSITION) {

                                        gain_confirmLaunch(fileSignatureAgreement);

                                    }

                                }
                            });

                            mAlertView.setCancelable(true);
                            mAlertView.show();


                            break;
                        }

//                        case R.id.roundTextViewButton_signature_preview_manager: {//管理层-预览按钮
//
//                            gain_getSignTaskPreviewUrl(fileSignatureAgreement);
//
//                            break;
//                        }

                        case R.id.roundTextViewButton_signature_cancel_manager: {//管理层-领导的-作废

                            method_handler_button_cancel(fileSignatureAgreement);

                            break;
                        }

                        case R.id.roundTextViewButton_signature_signed_manager: {//经理确认签署，最后的一步，经理确认签署完毕就是签署任务完毕

                            gain_getFascManagerAuthUrl(fileSignatureAgreement, false, null);

                            break;
                        }

                        default:
                            break;
                    }

                }


            }
        });

        //界面的外侧包裹刷新
        if (refreshLayoutInSignatureDetail != null) {

            refreshLayoutInSignatureDetail.setOnRefreshListener(new OnRefreshListener() {
                @Override
                public void onRefresh(@NonNull RefreshLayout refreshLayout) {

                    refreshLayout.getLayout().post(new Runnable() {
                        @Override
                        public void run() {


                            gainDatas();

                            refreshLayout.finishRefresh();
                        }
                    });

                }
            });
        }


        //新增针对这个客户的签约，因为已经知道他的手机号
        if (layoutButtonCreateSignatureAgain != null) {

            layoutButtonCreateSignatureAgain.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {

                    //这里应该是直接弹窗，再次弹窗让客户扫码填写；
                    //method_edit_addSubmit(null);
                    //这里是一个签约弹窗；包含客户信息等
//                    method_create_signature_dialog();
                    method_edit_addSubmit(null);

                }
            });
        }

    }

    //
    private void method_handler_button_cancel(FileSignatureAgreement _fileSignatureAgreement) {

//        String informationId = fileSignatureAgreement.getInformationId();
//        String signTaskId = fileSignatureAgreement.getSignTaskId();

        CommUtils.checkDialog(mAlertView);

        mAlertView = new AlertView(StringUtils.getString(R.string.clearaddorsubmitsuretitletips), //提示
                getString(R.string.signature_cancel_current_agreement),//提示内容，确定提交吗？
                StringUtils.getString(R.string.clearcachecancel), //取消
                new String[]{StringUtils.getString(R.string.clearcachetitlesure)},//确定
                null, mActivityInstance, AlertView.Style.Alert, new com.ygxsk.carhome.alertview.OnItemClickListener() {//
            @Override
            public void onItemClick(Object o, int position) {

                if (position != AlertView.CANCELPOSITION) {

                    //作废接口
                    gain_cancelInformation(_fileSignatureAgreement);

                }

            }
        });

        mAlertView.setCancelable(true);
        mAlertView.show();


    }

    //
    private void method_edit_addSubmit(FileSignatureAgreement _fileSignatureAgreement) {

        //以这里做提交入口
        Bundle extra_bundle = new Bundle();

        extra_bundle.putInt(ExtraKey.EXTRA_JUMPFROM_WHERE, ExtraValue.VALUE_JUMP_FORM_SIGNATRUE_DETAIL_ACTIVITY);
        //携带这条信息过去，有一些初始化值，到下一个界面；
        extra_bundle.putParcelable(ExtraKey.EXTRA_SIGNATURE_FILESIGNATURE_AGREEMENT, _fileSignatureAgreement);
        extra_bundle.putParcelable(ExtraKey.EXTRA_SIGNATURE_FILESIGNATUREMANAGE, extra_fileSignatureManage);

        ActivityUtils.startActivity(extra_bundle, SignatureAddSubmitToActivity.class);

    }

    //添加头部信息内容
    private View getHeaderView(RecyclerView _recyclerViewWork) {

        View workHeader;

        if ((_recyclerViewWork != null) && (_recyclerViewWork.getParent() != null)) {
            workHeader = LayoutInflater.from(SignatureDetailActivity.this).inflate(//
                    R.layout.activity_signature_detail_header, //
                    (ViewGroup) _recyclerViewWork.getParent(),//
                    false);//
        } else {
            workHeader = LayoutInflater.from(SignatureDetailActivity.this).inflate(R.layout.activity_signature_detail_header, null);
        }

        //店铺名称
        textViewFileSignTemplateNameDetail = (TextView) workHeader.findViewById(R.id.textViewFileSignTemplateNameDetail);
        //合同签约时间
        textViewFileSignCreateTimeDetail = (TextView) workHeader.findViewById(R.id.textviewfilesigncreatetimedetail);
        //档案编号
        textViewFileSignatureDetail = (TextView) workHeader.findViewById(R.id.textviewfilesignaturedetail);
        //乙方名称
        textViewFileSignPartyBNameDetail = (TextView) workHeader.findViewById(R.id.textViewFileSignPartyBNameDetail);
        //乙方电话
        textViewFileSignPartyBPhoneDetail = (TextView) workHeader.findViewById(R.id.textViewFileSignPartyBPhoneDetail);
        //合同状态
        textViewFileSignContractStatusDetail = (TextView) workHeader.findViewById(R.id.textViewFileSignContractStatusDetail);

        //有没有默认值填充？
        method_handler_success(extra_fileSignatureManage);

        return workHeader;
    }

    @Override
    protected void gainDatas() {

        if (NetworkUtils.isConnected()) {

            getServerDatas();

        } else {
            //是否有其他的执行逻辑？
            netWorkError();
//            setEnableLoadmore(refreshLayoutInSignatureDetail, true);
        }

    }


    //处理接口调用
    private void method_handler_success(FileSignatureManage _fileSignatureManage) {

        //签约时间
        String createTime = _fileSignatureManage.getCreateTime();
        //档案编号
        String createSerialNo = _fileSignatureManage.getInformationNo();
        //合同模板--2023年10月30日15:45:14暂时改动为 店铺名称
        //String signTemplateName = fileSignatureManage.getSignTemplateName();

        //所在园区的名称
        String communityName = _fileSignatureManage.getCommunityName();
        //店铺名称：
        String signTemplateName = _fileSignatureManage.getShopInfoName();

        String resultShopName = "";

        if (!TextUtils.isEmpty(communityName)) {
            resultShopName = signTemplateName + StringUtils.getString(R.string.kongge0) + StringUtils.getString(R.string.bracket_left_small) + communityName + StringUtils.getString(R.string.bracket_right_small);
        } else {
            resultShopName = signTemplateName;
        }

        //乙方名称--也即是 客户名称
        String clientName = _fileSignatureManage.getClientName();

        //乙方电话  客户手机号
        String clientPhone = _fileSignatureManage.getClientPhone();

        //添加合同的状态 或者是暂时的状态
        //合同状态
//        String informationStatus = _fileSignatureManage.getAuditStatus();
        //             enum FileSignatureBoxStatus {
//                //审核状态   0填写中，1待审核  2通过  3不通过
//                AUDITSTATUS_FILL("0"),//
//                AUDITSTATUS_TO_BE_REVIEWED("1"),//
//                AUDITSTATUS_PASSED("2"),//
//                AUDITSTATUS_FAILED("3");//

        //档案状态  数值状态
        String auditStatus = _fileSignatureManage.getAuditStatus();
        LogUtils.d(ConstantSign.LOGCAT_NOMAL + "--auditStatus-->" + auditStatus);

        //档案状态  汉字状态
        String auditStatusInfo = "";

        if (!TextUtils.isEmpty(auditStatus)) {

            if (TextUtils.equals(auditStatus, FileSignatureBoxStatus.AUDITSTATUS_FILL.getIndex())) {

                //填写中
                auditStatusInfo = FileSignatureBoxStatus.AUDITSTATUS_FILL.getValue();

            } else if (TextUtils.equals(auditStatus, FileSignatureBoxStatus.AUDITSTATUS_TO_BE_REVIEWED.getIndex())) {

                //待审核
                auditStatusInfo = FileSignatureBoxStatus.AUDITSTATUS_TO_BE_REVIEWED.getValue();

            } else if (TextUtils.equals(auditStatus, FileSignatureBoxStatus.AUDITSTATUS_PASSED.getIndex())) {

                //通过
                auditStatusInfo = FileSignatureBoxStatus.AUDITSTATUS_PASSED.getValue();


            } else if (TextUtils.equals(auditStatus, FileSignatureBoxStatus.AUDITSTATUS_FAILED.getIndex())) {

                //不通过
                auditStatusInfo = FileSignatureBoxStatus.AUDITSTATUS_FAILED.getValue();


            }

        }

        //签约时间
        CommUtils.setText(textViewFileSignCreateTimeDetail, createTime);
        //档案编号
        CommUtils.setText(textViewFileSignatureDetail, createSerialNo);
        //模板名称--2023年10月30日15:58:37改为店铺名称
        CommUtils.setText(textViewFileSignTemplateNameDetail, resultShopName);
        //乙方姓名,客户姓名
        CommUtils.setText(textViewFileSignPartyBNameDetail, clientName);
        //乙方电话
        CommUtils.setText(textViewFileSignPartyBPhoneDetail, clientPhone);
        //档案盒子的状态
        CommUtils.setText(textViewFileSignContractStatusDetail, auditStatusInfo);

        //判断是 从正常的列表进入详情 还是 从历史记录进入详情；
        if (extra_jumpfrom_where == ExtraValue.VALUE_JUMPFROM_SIGNATURE_ACTIVITY_ONITEM_CLICK_INTO) {

            //正常的，档案合同管理页面进来，就展示按钮，应该是要区分 是领导或者是员工；
//            linearLayoutTwoWrapButtonsDetail.setVisibility(View.VISIBLE);
//          textViewLineToptoButtons.setVisibility(View.VISIBLE);

            // TODO: 2023-10-31 10:54 判断身份；
            // TODO: 2023-10-31 10:50 如果是销售领导的话，那么它进页面 就只能查看，不能操作；


        } else if (extra_jumpfrom_where == ExtraValue.VALUE_JUMPFROM_SIGNATURE_HISTROY_ACTIVITY_ONITEM_CLICK_INTO) {

            //历史记录进入
//            linearLayoutTwoWrapButtonsDetail.setVisibility(View.VISIBLE);
//          textViewLineToptoButtons.setVisibility(View.GONE);

            //判断身份

        }

    }


    //各种按钮的接口内容
    private void getServerDatas() {

        HashMap<String, Object> map = new HashMap<>();
        map.put(Parameterkey.shopInfoId, mSession.getShopInfoId());
        map.put(Parameterkey.informationId, extra_fileSignatureManage.getInformationId());

//        map.put(Parameterkey.status, "1");//状态
//        map.put(Parameterkey.pagination, pagination_upLoad);//传递的页码
//        map.put(Parameterkey.pageSize, Parameterkey.pageSize_default);//,搜索关键字

        AddLogUpLoadInfo addLogUpLoadInfo = new AddLogUpLoadInfo();
        addLogUpLoadInfo.setActivity(mActivityInstance);
        addLogUpLoadInfo.setWhat(ConstantApi.WHAT_GETAPPOINTMENTLISTPAGE);//请求数字标识
        addLogUpLoadInfo.setUrlPath(ApiService.getAppointmentListPage_url);//url地址
        addLogUpLoadInfo.setRequestMethod(ConstantSign.REQUEST_METHOD_POST);//POST 或者 GET
        addLogUpLoadInfo.setToastToUser(false);//展示给用户的标志
        addLogUpLoadInfo.setHashMapParameter(map);

        NetworkManager.getInstance().initRetrofitRxJava()
                .create(ApiService.class)
                .getInformationManageDetail(RequestBody.create(JSON.toJSONString(map, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue),
                        MediaType.parse(ApiService.HEADER_JSON)))
                .compose(SignatureDetailActivity.this.bindUntilEvent(ActivityEvent.DESTROY))//
                .compose(new ResponseTransformer<>(addLogUpLoadInfo, new ApiRequestSubListener<ArrayList<FileSignatureAgreement>>() {
                    @Override
                    public void handlerSomeThingNotSuccessDataForItSelf(int what_method, String serverCode, String serverMessage) {
                        super.handlerSomeThingNotSuccessDataForItSelf(what_method, serverCode, serverMessage);
                        //{"data":"","message":"无数据","code":"20002"}
                        if (!TextUtils.isEmpty(serverCode)) {
                            if (!TextUtils.equals(serverCode, ConstantSign.RESPONSE_20002)) {
                                ToastUtils.showShort(serverMessage);
                            }
                        }
                    }
                })).doOnSubscribe(new Consumer<Disposable>() {
                    @Override
                    public void accept(Disposable disposable) throws Throwable {

                        loadingGone();

                    }
                }).subscribe(new Consumer<ArrayList<FileSignatureAgreement>>() {
                    @Override
                    public void accept(ArrayList<FileSignatureAgreement> fileSignatureAgreementArrayList) throws Throwable {

                        if (fileSignatureAgreementArrayList != null) {

                            if (mDataResources != null && !mDataResources.isEmpty()) {
                                mDataResources.clear();
                            }

                            if (mDataResources != null) {
                                mDataResources.addAll(fileSignatureAgreementArrayList);
                            }

                            if (fileSignatureAgreementAdapter != null) {
                                fileSignatureAgreementAdapter.notifyDataSetChanged();
                            }

                        }

                    }
                }, new ErrorConsumer() {

                    @Override
                    protected void error(ApiException apiException) {

                        //页面报错；
                        if (apiException != null) {
                            ToastUtils.showShort(apiException.getDisplayMessage());
                        }

                    }
                });


    }

    //签署的最后一阶段，经理签约；
    private void gain_getFascManagerAuthUrl(FileSignatureAgreement _fileSignatureAgreement, boolean _isRefreshQRCode, ImageView _imageViewQRCode_manager) {

        if (NetworkUtils.isConnected()) {

            HashMap<String, Object> map = new HashMap<>();
            map.put(Parameterkey.shopInfoId, mSession.getShopInfoId());
            map.put(Parameterkey.signTaskId, _fileSignatureAgreement.getSignTaskId());//电子签章系统签署任务ID,优先使用签署任务ID
            map.put(Parameterkey.managerId, _fileSignatureAgreement.getManagerId());//该是销售经理的管理id
            map.put(Parameterkey.informationId, _fileSignatureAgreement.getInformationId());//车辆档案ID

            AddLogUpLoadInfo addLogUpLoadInfo = new AddLogUpLoadInfo();
            addLogUpLoadInfo.setActivity(mActivityInstance);
            addLogUpLoadInfo.setWhat(ConstantApi.WHAT_GETFASCMANAGERAUTHURL_URL);//请求数字标识
            addLogUpLoadInfo.setUrlPath(ApiService.getFascManagerAuthUrl_url);//url地址
            addLogUpLoadInfo.setRequestMethod(ConstantSign.REQUEST_METHOD_POST);//POST 或者 GET
            addLogUpLoadInfo.setToastToUser(false);//展示给用户的标志
            addLogUpLoadInfo.setHashMapParameter(map);

            NetworkManager.getInstance().initRetrofitRxJava()
                    .create(ApiService.class)
                    .getFascManagerAuthUrl(RequestBody.create(JSON.toJSONString(map, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue),
                            MediaType.parse(ApiService.HEADER_JSON)))
                    .compose(SignatureDetailActivity.this.bindUntilEvent(ActivityEvent.DESTROY))//
                    .compose(new ResponseTransformer<>(addLogUpLoadInfo, new ApiRequestSubListener<SignatureWebInformationBean>() {
                        @Override
                        public void handlerSomeThingNotSuccessDataForItSelf(int what_method, String serverCode, String serverMessage) {
                            super.handlerSomeThingNotSuccessDataForItSelf(what_method, serverCode, serverMessage);

                            CommUtils.checkMaterialDialog(materialDialog);

                            //{"data":"","message":"无更多数据","code":"29999"}
                            //这里要不要给提示？无更多数据
                            if (!TextUtils.equals(serverCode, ConstantSign.RESPONSE_STRING_29999)) {

                                if (!TextUtils.isEmpty(serverMessage)) {
                                    ToastUtils.showShort(serverMessage);
                                }

                            } else {

                                CommUtils.checkDialog(mAlertView);
                                mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, serverMessage, true);
                                mAlertView.show();

                            }

                        }
                    })).doOnSubscribe(new Consumer<Disposable>() {
                        @Override
                        public void accept(Disposable disposable) throws Throwable {
                            method_create_materialDialog(mActivityInstance, ConstantSign.TIPS_LOADING);
                        }
                    }).subscribe(new Consumer<SignatureWebInformationBean>() {
                        @SuppressLint("CheckResult")
                        @Override
                        public void accept(SignatureWebInformationBean signatureWebInformationBean) throws Throwable {

                            CommUtils.checkMaterialDialog(materialDialog);

//                            {
//                                "code":"20000",
//                                     "data":{
//                                      "qrUrl":"http://222.222.17.184:8990/resource/file/information/fasc/qr/15612345670-经理审核二维码.jpg",
//                                        "actorUrl":"https://80000333.uat-e.fadada.com/connect?resourceUrl=https%3A%2F%2F80000333.uat-e.fadada.com%2Fapplication%2Ftask%2Fsign%2Fdetail%3FsignTaskId%3D1698836030787178565%26integrationCallbackUrl%3Dhttp%253A%252F%252F222.222.17.184%253A8991%252Fsignature%252Fcallback%253Fapi%253Dpub%252Fv1%252Ffasc%252FactorSignCallBack%26isFromApiIntegration%3Dtrue%26isFreeLogin%3D0%26partyId%3D1698836031359174340%26paramSign%3Daca19d23f48eaae0bc2d68fefac0064f797bf8f26bdfff38bc4b123d15484d86&userAccessTicket=b13e54a4c31e49eba7009cb70b189a7c",
//                                        "informationId":20
//                            },
//                                 "message":"success"
//                            }

//                            String qrUrl = signatureWebInformationBean.getQrUrl();
                            String actorUrl = signatureWebInformationBean.getActorUrl();
//                            String informationId = signatureWebInformationBean.getInformationId();

                            //第二种方式：经理【确认签署】直接打开链接；
                            ViewUitls.method_toWebView_signature(getString(R.string.signatrue_sure_text), actorUrl);

                            //如下路基勿删除；是经理确认签署的二维码弹窗；在2023年11月4日11:48:13更改需求：
                            //展示签署二维码和发送二维码签署链接是一起的；
//                            if (_isRefreshQRCode) {
//
//                                LogUtils.d(ConstantSign.LOGCAT_NOMAL + "执行了【刷新】逻辑");
//
//                                //如果是刷新二维码，那么弹窗是已经展开的，通知二维码的展示刷新
//                                //发送消息 刷新二维码图片
//                                if (_imageViewQRCode_manager != null) {
//
//                                    Glide.with(SignatureDetailActivity.this)
//                                            .load(qrUrl)
//                                            .placeholder(R.drawable.icon_errorfang)//
//                                            .error(R.drawable.icon_errorfang)//
//                                            .fitCenter()
//                                            .diskCacheStrategy(DiskCacheStrategy.NONE)//动态获取新值不缓存
//                                            .into(_imageViewQRCode_manager);
//                                }
//
//                            } else {
//
//                                //不是刷新二维码，是直接弹窗展示签署二维码给销售经理；
//                                method_show_QRCode_dialog_to_manager(_fileSignatureAgreement, false, signatureWebInformationBean);
//
//                            }

                        }
                    }, new ErrorConsumer() {

                        @Override
                        protected void error(ApiException apiException) {

                            CommUtils.checkMaterialDialog(materialDialog);

                            //页面报错；给提示
                            if (apiException != null) {
                                ToastUtils.showShort(apiException.getDisplayMessage());
                            }

                        }
                    });

        } else {

            ToastUtils.showShort(StringUtils.getString(R.string.http_exception_network));

        }

    }

    //手机端发送签署链接到客户手机
    private void gain_sendFascActorUrl(FileSignatureAgreement _fileSignatureAgreement) {

        if (NetworkUtils.isConnected()) {

            HashMap<String, Object> map = new HashMap<>();
            map.put(Parameterkey.shopInfoId, mSession.getShopInfoId());
//            map.put(Parameterkey.signTaskId, mSession.getSignTaskId());//电子签章系统签署任务ID,优先使用签署任务ID
//            map.put(Parameterkey.managerId, mSession.getInformationId());//销售人员的id
            map.put(Parameterkey.informationId, _fileSignatureAgreement.getInformationId());//车辆档案ID

            AddLogUpLoadInfo addLogUpLoadInfo = new AddLogUpLoadInfo();
            addLogUpLoadInfo.setActivity(mActivityInstance);
            addLogUpLoadInfo.setWhat(ConstantApi.WHAT_SENDFASCACTORURL_URL);//请求数字标识
            addLogUpLoadInfo.setUrlPath(ApiService.sendFascActorUrl_url);//url地址
            addLogUpLoadInfo.setRequestMethod(ConstantSign.REQUEST_METHOD_POST);//POST 或者 GET
            addLogUpLoadInfo.setToastToUser(false);//展示给用户的标志
            addLogUpLoadInfo.setHashMapParameter(map);

            NetworkManager.getInstance().initRetrofitRxJava()
                    .create(ApiService.class)
                    .sendFascActorUrl(RequestBody.create(JSON.toJSONString(map, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue),
                            MediaType.parse(ApiService.HEADER_JSON)))
                    .compose(SignatureDetailActivity.this.bindUntilEvent(ActivityEvent.DESTROY))//
                    .compose(new ResponseTransformer<>(addLogUpLoadInfo, new ApiRequestSubListener<String>() {
                        @Override
                        public void handlerSomeThingNotSuccessDataForItSelf(int what_method, String serverCode, String serverMessage) {
                            super.handlerSomeThingNotSuccessDataForItSelf(what_method, serverCode, serverMessage);

                            CommUtils.checkMaterialDialog(materialDialog);

                            //{"data":"","message":"无更多数据","code":"29999"}
                            //这里要不要给提示？无更多数据
                            if (!TextUtils.equals(serverCode, ConstantSign.RESPONSE_STRING_29999)) {

                                if (!TextUtils.isEmpty(serverMessage)) {
                                    ToastUtils.showShort(serverMessage);
                                }

                            } else {

                                CommUtils.checkDialog(mAlertView);
                                mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, serverMessage, true);
                                mAlertView.show();

                            }

                        }
                    })).doOnSubscribe(new Consumer<Disposable>() {
                        @Override
                        public void accept(Disposable disposable) throws Throwable {
                            method_create_materialDialog(mActivityInstance, ConstantSign.TIPS_LOADING);
                        }
                    }).subscribe(new Consumer<String>() {
                        @Override
                        public void accept(String signatureString) throws Throwable {

                            CommUtils.checkMaterialDialog(materialDialog);

//                            if (!TextUtils.isEmpty(stringValue)) {
                            // TODO: 2023-10-27 15:32 链接是要跳转吗？给销售经理确认 二维码信息？
//                            }

                        }
                    }, new ErrorConsumer() {

                        @Override
                        protected void error(ApiException apiException) {

                            CommUtils.checkMaterialDialog(materialDialog);

                            //页面报错；给提示
                            if (apiException != null) {
                                ToastUtils.showShort(apiException.getDisplayMessage());
                            }

                        }
                    });

        } else {

            ToastUtils.showShort(StringUtils.getString(R.string.http_exception_network));

        }

    }


    //发起方签署任务连接失效后重新获取签署链接
    private void gain_resumeOwnerSignUrl(FileSignatureAgreement _fileSignatureAgreement) {

        if (NetworkUtils.isConnected()) {

            HashMap<String, Object> map = new HashMap<>();
            map.put(Parameterkey.shopInfoId, mSession.getShopInfoId());
            map.put(Parameterkey.signTaskId, _fileSignatureAgreement.getSignTaskId());//电子签章系统签署任务ID,优先使用签署任务ID
//            map.put(Parameterkey.informationId, mSession.getInformationId());//车辆档案ID
//            map.put(Parameterkey.managerId, mSession.getInformationId());//销售人员的id

            AddLogUpLoadInfo addLogUpLoadInfo = new AddLogUpLoadInfo();
            addLogUpLoadInfo.setActivity(mActivityInstance);
            addLogUpLoadInfo.setWhat(ConstantApi.WHAT_RESUMEOWNERSIGNURL_URL);//请求数字标识
            addLogUpLoadInfo.setUrlPath(ApiService.resumeOwnerSignUrl_url);//url地址
            addLogUpLoadInfo.setRequestMethod(ConstantSign.REQUEST_METHOD_POST);//POST 或者 GET
            addLogUpLoadInfo.setToastToUser(false);//展示给用户的标志
            addLogUpLoadInfo.setHashMapParameter(map);

            NetworkManager.getInstance().initRetrofitRxJava()
                    .create(ApiService.class)
                    .resumeOwnerSignUrl(RequestBody.create(JSON.toJSONString(map, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue),
                            MediaType.parse(ApiService.HEADER_JSON)))
                    .compose(SignatureDetailActivity.this.bindUntilEvent(ActivityEvent.DESTROY))//
                    .compose(new ResponseTransformer<>(addLogUpLoadInfo, new ApiRequestSubListener<String>() {
                        @Override
                        public void handlerSomeThingNotSuccessDataForItSelf(int what_method, String serverCode, String serverMessage) {
                            super.handlerSomeThingNotSuccessDataForItSelf(what_method, serverCode, serverMessage);

                            CommUtils.checkMaterialDialog(materialDialog);

                            //{"data":"","message":"无更多数据","code":"29999"}
                            //这里要不要给提示？无更多数据
                            if (!TextUtils.equals(serverCode, ConstantSign.RESPONSE_STRING_29999)) {

                                if (!TextUtils.isEmpty(serverMessage)) {
                                    ToastUtils.showShort(serverMessage);
                                }

                            } else {

                                CommUtils.checkDialog(mAlertView);
                                mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, serverMessage, true);
                                mAlertView.show();

                            }

                        }
                    })).doOnSubscribe(new Consumer<Disposable>() {
                        @Override
                        public void accept(Disposable disposable) throws Throwable {
                            method_create_materialDialog(mActivityInstance, ConstantSign.TIPS_LOADING);
                        }
                    }).subscribe(new Consumer<String>() {
                        @Override
                        public void accept(String signatureString) throws Throwable {

                            CommUtils.checkMaterialDialog(materialDialog);

                            if (!TextUtils.isEmpty(signatureString)) {
                                // TODO: 2023-10-27 15:32 链接是要跳转吗？给销售经理确认 二维码信息？
                                ViewUitls.method_toWebView_signature(_fileSignatureAgreement.getSignTemplateName(), signatureString);
                            }


                        }
                    }, new ErrorConsumer() {

                        @Override
                        protected void error(ApiException apiException) {

                            CommUtils.checkMaterialDialog(materialDialog);

                            //页面报错；给提示
                            if (apiException != null) {
                                ToastUtils.showShort(apiException.getDisplayMessage());
                            }

                        }
                    });

        } else {

            ToastUtils.showShort(StringUtils.getString(R.string.http_exception_network));

        }


    }


    //手机端发起审批的新接口  响应内容什么的有变化
    private void gain_noticeManager(FileSignatureAgreement _fileSignatureAgreement) {

        if (NetworkUtils.isConnected()) {

            HashMap<String, Object> map = new HashMap<>();
            map.put(Parameterkey.shopInfoId, mSession.getShopInfoId());
            map.put(Parameterkey.signTaskId, _fileSignatureAgreement.getSignTaskId());//电子签章系统签署任务ID,优先使用签署任务ID
            map.put(Parameterkey.informationId, _fileSignatureAgreement.getInformationId());//车辆档案ID
            map.put(Parameterkey.managerId, _fileSignatureAgreement.getManagerId());//销售人员的id

            AddLogUpLoadInfo addLogUpLoadInfo = new AddLogUpLoadInfo();
            addLogUpLoadInfo.setActivity(mActivityInstance);
            addLogUpLoadInfo.setWhat(ConstantApi.WHAT_NOTICEMANAGER_URL);//请求数字标识
            addLogUpLoadInfo.setUrlPath(ApiService.noticeManager_url);//url地址
            addLogUpLoadInfo.setRequestMethod(ConstantSign.REQUEST_METHOD_POST);//POST 或者 GET
            addLogUpLoadInfo.setToastToUser(false);//展示给用户的标志
            addLogUpLoadInfo.setHashMapParameter(map);

            NetworkManager.getInstance().initRetrofitRxJava()
                    .create(ApiService.class)
                    .noticeManager(RequestBody.create(JSON.toJSONString(map, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue),
                            MediaType.parse(ApiService.HEADER_JSON)))
                    .compose(SignatureDetailActivity.this.bindUntilEvent(ActivityEvent.DESTROY))//
                    .compose(new ResponseTransformer<>(addLogUpLoadInfo, new ApiRequestSubListener<String>() {
                        @Override
                        public void handlerSomeThingNotSuccessDataForItSelf(int what_method, String serverCode, String serverMessage) {
                            super.handlerSomeThingNotSuccessDataForItSelf(what_method, serverCode, serverMessage);

                            CommUtils.checkMaterialDialog(materialDialog);

                            //{"data":"","message":"无更多数据","code":"29999"}
                            //这里要不要给提示？无更多数据
//                            if (!TextUtils.isEmpty(serverMessage)) {
//                                ToastUtils.showShort(serverMessage);
//                            }

                            if (!TextUtils.equals(serverCode, ConstantSign.RESPONSE_STRING_29999)) {

                                if (!TextUtils.isEmpty(serverMessage)) {
                                    ToastUtils.showShort(serverMessage);
                                }

                            } else {

                                CommUtils.checkDialog(mAlertView);
                                mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, serverMessage, true);
                                mAlertView.show();

                            }

                        }
                    })).doOnSubscribe(new Consumer<Disposable>() {
                        @Override
                        public void accept(Disposable disposable) throws Throwable {
                            method_create_materialDialog(mActivityInstance, ConstantSign.TIPS_LOADING);
                        }
                    }).subscribe(new Consumer<String>() {
                        @Override
                        public void accept(String stringValue) throws Throwable {

                            CommUtils.checkMaterialDialog(materialDialog);

//                            {
//                                "code":"20000",
//                                    "data":{
//                                        "qrUrl":"http://222.222.17.184:8990/resource/file/information/fasc/qr/18903225665-经理审核二维码.jpg",
//                                        "actorUrl":"https://80000333.uat-e.fadada.com/connect?resourceUrl=https%3A%2F%2F80000333.uat-e.fadada.com%2Fapplication%2Ftask%2Fsign%2Fdetail%3FsignTaskId%3D1698631089178111330%26integrationCallbackUrl%3Dhttp%253A%252F%252F222.222.17.184%253A8991%252Fsignature%252Fcallback%253Fapi%253Dpub%252Fv1%252Ffasc%252FactorSignCallBack%26isFromApiIntegration%3Dtrue%26isFreeLogin%3D0%26partyId%3D1698631089573187146%26paramSign%3Dd4f8f68368e3138f1d43ed03af0266ad5c5a79514d91a1c4c0c988d839ee696d&userAccessTicket=902ccb6fee2c4ad08477316f53903cca",
//                                        "informationId":8
//                               },
//                                "message":"success"
//                            }


//                            String qrUrl = signatureWebInformationBean.getQrUrl();
//                            String actorUrl = signatureWebInformationBean.getActorUrl();
//                            String informationId = signatureWebInformationBean.getInformationId();
//
//                            PopTip.show(getResources().getString(R.string.send_links_to_manager)).iconSuccess();
//
//                            //打开签署二维码:管理层签署二维码-经理审核二维码，然后当 销售员工点击【关闭】状态变动 要刷新 列表；
//                            method_show_QRCode_dialog(getResources().getString(R.string.signature_send_qrcode_manager), qrUrl);


//                            {
//                                    "code":"20000",
//                                    "data":true,
//                                    "message":"success"
//                            }

                            PopTip.show(getResources().getString(R.string.send_message_to_manager)).iconSuccess();


                        }
                    }, new ErrorConsumer() {

                        @Override
                        protected void error(ApiException apiException) {

                            CommUtils.checkMaterialDialog(materialDialog);

                            //页面报错；给提示
                            if (apiException != null) {
                                ToastUtils.showShort(apiException.getDisplayMessage());
                            }

                        }
                    });

        } else {

            ToastUtils.showShort(StringUtils.getString(R.string.http_exception_network));

        }

    }

    //手机端通知销售经理

//    private void gain_noticeManager(FileSignatureAgreement _fileSignatureAgreement) {
//
//        if (NetworkUtils.isConnected()) {
//
//            HashMap<String, Object> map = new HashMap<>();
//            map.put(Parameterkey.shopInfoId, mSession.getShopInfoId());
//            map.put(Parameterkey.signTaskId, _fileSignatureAgreement.getSignTaskId());//电子签章系统签署任务ID,优先使用签署任务ID
//            map.put(Parameterkey.informationId, _fileSignatureAgreement.getInformationId());//车辆档案ID
//            map.put(Parameterkey.managerId, _fileSignatureAgreement.getManagerId());//销售人员的id
//
//            AddLogUpLoadInfo addLogUpLoadInfo = new AddLogUpLoadInfo();
//            addLogUpLoadInfo.setActivity(mActivityInstance);
//            addLogUpLoadInfo.setWhat(ConstantApi.WHAT_NOTICEMANAGER_URL);//请求数字标识
//            addLogUpLoadInfo.setUrlPath(ApiService.noticeManager_url);//url地址
//            addLogUpLoadInfo.setRequestMethod(ConstantSign.REQUEST_METHOD_POST);//POST 或者 GET
//            addLogUpLoadInfo.setToastToUser(false);//展示给用户的标志
//            addLogUpLoadInfo.setHashMapParameter(map);
//
//            NetworkManager.getInstance().initRetrofitRxJava()
//                    .create(ApiService.class)
//                    .noticeManager(RequestBody.create(JSON.toJSONString(map, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue),
//                            MediaType.parse(ApiService.HEADER_JSON)))
//                    .compose(SignatureDetailActivity.this.bindUntilEvent(ActivityEvent.DESTROY))//
//                    .compose(new ResponseTransformer<>(addLogUpLoadInfo, new ApiRequestSubListener<SignatureWebInformationBean>() {
//                        @Override
//                        public void handlerSomeThingNotSuccessDataForItSelf(int what_method, String serverCode, String serverMessage) {
//                            super.handlerSomeThingNotSuccessDataForItSelf(what_method, serverCode, serverMessage);
//
//                            CommUtils.checkMaterialDialog(materialDialog);
//
//                            //{"data":"","message":"无更多数据","code":"29999"}
//                            //这里要不要给提示？无更多数据
////                            if (!TextUtils.isEmpty(serverMessage)) {
////                                ToastUtils.showShort(serverMessage);
////                            }
//
//                            if (!TextUtils.equals(serverCode, ConstantSign.RESPONSE_STRING_29999)) {
//
//                                if (!TextUtils.isEmpty(serverMessage)) {
//                                    ToastUtils.showShort(serverMessage);
//                                }
//
//                            } else {
//
//                                CommUtils.checkDialog(mAlertView);
//                                mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, serverMessage, true);
//                                mAlertView.show();
//
//                            }
//
//                        }
//                    })).doOnSubscribe(new Consumer<Disposable>() {
//                        @Override
//                        public void accept(Disposable disposable) throws Throwable {
//                            method_create_materialDialog(ConstantSign.TIPS_LOADING);
//                        }
//                    }).subscribe(new Consumer<SignatureWebInformationBean>() {
//                        @Override
//                        public void accept(SignatureWebInformationBean signatureWebInformationBean) throws Throwable {
//
//                            CommUtils.checkMaterialDialog(materialDialog);
//
////                            {
////                                "code":"20000",
////                                    "data":{
////                                        "qrUrl":"http://222.222.17.184:8990/resource/file/information/fasc/qr/18903225665-经理审核二维码.jpg",
////                                        "actorUrl":"https://80000333.uat-e.fadada.com/connect?resourceUrl=https%3A%2F%2F80000333.uat-e.fadada.com%2Fapplication%2Ftask%2Fsign%2Fdetail%3FsignTaskId%3D1698631089178111330%26integrationCallbackUrl%3Dhttp%253A%252F%252F222.222.17.184%253A8991%252Fsignature%252Fcallback%253Fapi%253Dpub%252Fv1%252Ffasc%252FactorSignCallBack%26isFromApiIntegration%3Dtrue%26isFreeLogin%3D0%26partyId%3D1698631089573187146%26paramSign%3Dd4f8f68368e3138f1d43ed03af0266ad5c5a79514d91a1c4c0c988d839ee696d&userAccessTicket=902ccb6fee2c4ad08477316f53903cca",
////                                        "informationId":8
////                               },
////                                "message":"success"
////                            }
//
//
//                            String qrUrl = signatureWebInformationBean.getQrUrl();
//                            String actorUrl = signatureWebInformationBean.getActorUrl();
//                            String informationId = signatureWebInformationBean.getInformationId();
//
//                            PopTip.show(getResources().getString(R.string.send_links_to_manager)).iconSuccess();
//
//                            //打开签署二维码:管理层签署二维码-经理审核二维码，然后当 销售员工点击【关闭】状态变动 要刷新 列表；
//                            method_show_QRCode_dialog(getResources().getString(R.string.signature_send_qrcode_manager), qrUrl);
//
//
//                        }
//                    }, new ErrorConsumer() {
//
//                        @Override
//                        protected void error(ApiException apiException) {
//
//                            CommUtils.checkMaterialDialog(materialDialog);
//
//                            //页面报错；给提示
//                            if (apiException != null) {
//                                ToastUtils.showShort(apiException.getDisplayMessage());
//                            }
//
//                        }
//                    });
//
//        } else {
//
//            ToastUtils.showShort(StringUtils.getString(R.string.http_exception_network));
//
//        }
//
//    }

    //手机端 是管理层--领导---确认发起电子合同
    private void gain_confirmLaunch(FileSignatureAgreement _fileSignatureAgreement) {

        if (NetworkUtils.isConnected()) {

            HashMap<String, Object> map = new HashMap<>();
            map.put(Parameterkey.shopInfoId, mSession.getShopInfoId());
            map.put(Parameterkey.signTaskId, _fileSignatureAgreement.getSignTaskId());//电子签章系统签署任务ID,优先使用签署任务ID
            map.put(Parameterkey.informationId, _fileSignatureAgreement.getInformationId());//车辆档案ID

            AddLogUpLoadInfo addLogUpLoadInfo = new AddLogUpLoadInfo();
            addLogUpLoadInfo.setActivity(mActivityInstance);
            addLogUpLoadInfo.setWhat(ConstantApi.WHAT_CONFIRMLAUNCH_URL);//请求数字标识
            addLogUpLoadInfo.setUrlPath(ApiService.confirmLaunch_url);//url地址
            addLogUpLoadInfo.setRequestMethod(ConstantSign.REQUEST_METHOD_POST);//POST 或者 GET
            addLogUpLoadInfo.setToastToUser(false);//展示给用户的标志
            addLogUpLoadInfo.setHashMapParameter(map);

            NetworkManager.getInstance().initRetrofitRxJava()
                    .create(ApiService.class)
                    .confirmLaunch(RequestBody.create(JSON.toJSONString(map, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue),
                            MediaType.parse(ApiService.HEADER_JSON)))
                    .compose(SignatureDetailActivity.this.bindUntilEvent(ActivityEvent.DESTROY))//
                    .compose(new ResponseTransformer<>(addLogUpLoadInfo, new ApiRequestSubListener<String>() {
                        @Override
                        public void handlerSomeThingNotSuccessDataForItSelf(int what_method, String serverCode, String serverMessage) {
                            super.handlerSomeThingNotSuccessDataForItSelf(what_method, serverCode, serverMessage);

                            CommUtils.checkMaterialDialog(materialDialog);

                            //{"data":"","message":"无更多数据","code":"29999"}
                            //{"data":"","message":"签署任务状态不是填写完成，不允许定稿","code":"29999"}

                            //这里要不要给提示？无更多数据
                            if (!TextUtils.equals(serverCode, ConstantSign.RESPONSE_STRING_29999)) {

                                if (!TextUtils.isEmpty(serverMessage)) {
                                    ToastUtils.showShort(serverMessage);
                                }

                            } else {

                                CommUtils.checkDialog(mAlertView);
                                mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, serverMessage, true);
                                mAlertView.show();

                            }

                        }
                    })).doOnSubscribe(new Consumer<Disposable>() {
                        @Override
                        public void accept(Disposable disposable) throws Throwable {
                            method_create_materialDialog(mActivityInstance, ConstantSign.TIPS_LOADING);
                        }
                    }).subscribe(new Consumer<String>() {
                        @Override
                        public void accept(String stringValue) throws Throwable {

                            CommUtils.checkMaterialDialog(materialDialog);

//                            if (!TextUtils.isEmpty(stringValue)) {
                            //  2023-10-27 15:32 链接是要跳转吗？
//                            }

                            //电子合同发起成功
                            PopTip.show(getResources().getString(R.string.signature_send_success)).iconSuccess();
                            //合同定稿要刷新列表
                            method_refresh_detail();

                        }
                    }, new ErrorConsumer() {

                        @Override
                        protected void error(ApiException apiException) {

                            CommUtils.checkMaterialDialog(materialDialog);

                            //页面报错；给提示
                            if (apiException != null) {
                                ToastUtils.showShort(apiException.getDisplayMessage());
                            }

                        }
                    });

        } else {

            ToastUtils.showShort(StringUtils.getString(R.string.http_exception_network));

        }

    }

    //获取签署任务预览链接
    private void gain_getSignTaskPreviewUrl(FileSignatureAgreement _fileSignatureAgreement) {

        if (NetworkUtils.isConnected()) {

            HashMap<String, Object> map = new HashMap<>();
            map.put(Parameterkey.shopInfoId, mSession.getShopInfoId());
            map.put(Parameterkey.signTaskId, _fileSignatureAgreement.getSignTaskId());

            AddLogUpLoadInfo addLogUpLoadInfo = new AddLogUpLoadInfo();
            addLogUpLoadInfo.setActivity(mActivityInstance);
            addLogUpLoadInfo.setWhat(ConstantApi.WHAT_GETSIGNTASKPREVIEWURL_URL);//请求数字标识
            addLogUpLoadInfo.setUrlPath(ApiService.getSignTaskPreviewUrl_url);//url地址
            addLogUpLoadInfo.setRequestMethod(ConstantSign.REQUEST_METHOD_POST);//POST 或者 GET
            addLogUpLoadInfo.setToastToUser(false);//展示给用户的标志
            addLogUpLoadInfo.setHashMapParameter(map);

            NetworkManager.getInstance().initRetrofitRxJava()
                    .create(ApiService.class)
                    .getSignTaskPreviewUrl(RequestBody.create(JSON.toJSONString(map, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue),
                            MediaType.parse(ApiService.HEADER_JSON)))
                    .compose(SignatureDetailActivity.this.bindUntilEvent(ActivityEvent.DESTROY))//
                    .compose(new ResponseTransformer<>(addLogUpLoadInfo, new ApiRequestSubListener<String>() {
                        @Override
                        public void handlerSomeThingNotSuccessDataForItSelf(int what_method, String serverCode, String serverMessage) {
                            super.handlerSomeThingNotSuccessDataForItSelf(what_method, serverCode, serverMessage);

                            CommUtils.checkMaterialDialog(materialDialog);

                            //{"data":"","message":"无更多数据","code":"29999"}
                            //这里要不要给提示？无更多数据
//                            if (!TextUtils.isEmpty(serverMessage)) {
//                                ToastUtils.showShort(serverMessage);
//                            }

                            if (!TextUtils.equals(serverCode, ConstantSign.RESPONSE_STRING_29999)) {

                                if (!TextUtils.isEmpty(serverMessage)) {
                                    ToastUtils.showShort(serverMessage);
                                }

                            } else {

                                CommUtils.checkDialog(mAlertView);
                                mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, serverMessage, true);
                                mAlertView.show();

                            }


                        }
                    })).doOnSubscribe(new Consumer<Disposable>() {
                        @Override
                        public void accept(Disposable disposable) throws Throwable {
                            method_create_materialDialog(mActivityInstance, ConstantSign.TIPS_LOADING);
                        }
                    }).subscribe(new Consumer<String>() {
                        @Override
                        public void accept(String stringValue) throws Throwable {

                            CommUtils.checkMaterialDialog(materialDialog);

                            if (!TextUtils.isEmpty(stringValue)) {
                                // TODO: 2023-10-27 15:32 链接是要跳转吗？
                                ViewUitls.method_toWebView_signature("签署任务预览", stringValue);
                            }

                        }
                    }, new ErrorConsumer() {

                        @Override
                        protected void error(ApiException apiException) {

                            CommUtils.checkMaterialDialog(materialDialog);

                            //页面报错；给提示
                            if (apiException != null) {
                                ToastUtils.showShort(apiException.getDisplayMessage());
                            }

                        }
                    });

        } else {

            ToastUtils.showShort(StringUtils.getString(R.string.http_exception_network));

        }

    }

    //作废合同内容，废弃它；
    private void gain_cancelInformation(FileSignatureAgreement _fileSignatureAgreement) {

        if (NetworkUtils.isConnected()) {

            HashMap<String, Object> map = new HashMap<>();
            map.put(Parameterkey.shopInfoId, mSession.getShopInfoId());
            map.put(Parameterkey.informationId, _fileSignatureAgreement.getInformationId());//此档案的id
            map.put(Parameterkey.signTaskId, _fileSignatureAgreement.getSignTaskId());//合同模板ID

            AddLogUpLoadInfo addLogUpLoadInfo = new AddLogUpLoadInfo();
            addLogUpLoadInfo.setActivity(mActivityInstance);
            addLogUpLoadInfo.setWhat(ConstantApi.WHAT_GETFASCACTORQR_URL);//请求数字标识
            addLogUpLoadInfo.setUrlPath(ApiService.getFascActorQr_url);//url地址
            addLogUpLoadInfo.setRequestMethod(ConstantSign.REQUEST_METHOD_POST);//POST 或者 GET
            addLogUpLoadInfo.setToastToUser(false);//展示给用户的标志
            addLogUpLoadInfo.setHashMapParameter(map);


            NetworkManager.getInstance().initRetrofitRxJava()
                    .create(ApiService.class)
                    .cancelInformation(RequestBody.create(JSON.toJSONString(map, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue),
                            MediaType.parse(ApiService.HEADER_JSON)))
                    .compose(SignatureDetailActivity.this.bindUntilEvent(ActivityEvent.DESTROY))//
                    .compose(new ResponseTransformer<>(addLogUpLoadInfo, new ApiRequestSubListener<String>() {
                        @Override
                        public void handlerSomeThingNotSuccessDataForItSelf(int what_method, String serverCode, String serverMessage) {
                            super.handlerSomeThingNotSuccessDataForItSelf(what_method, serverCode, serverMessage);

                            CommUtils.checkMaterialDialog(materialDialog);

                            //{"data":"","message":"无更多数据","code":"29999"}
                            //这里要不要给提示？无更多数据
//                            if (!TextUtils.isEmpty(serverMessage)) {
//                                ToastUtils.showShort(serverMessage);
//                            }

                            if (!TextUtils.equals(serverCode, ConstantSign.RESPONSE_STRING_29999)) {

                                if (!TextUtils.isEmpty(serverMessage)) {
                                    ToastUtils.showShort(serverMessage);
                                }

                            } else {

                                CommUtils.checkDialog(mAlertView);
                                mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, serverMessage, true);
                                mAlertView.show();

                            }

                        }
                    })).doOnSubscribe(new Consumer<Disposable>() {
                        @Override
                        public void accept(Disposable disposable) throws Throwable {
                            method_create_materialDialog(mActivityInstance, ConstantSign.TIPS_LOADING);
                        }
                    }).subscribe(new Consumer<String>() {
                        @Override
                        public void accept(String signatureString) throws Throwable {

                            CommUtils.checkMaterialDialog(materialDialog);

//                            {
//                                "code": "20000",
//                                    "data": {
//                                        "qrUrl": "http://222.222.17.184:8990/resource/15144218047-签署二维码.jpg", //二维码地址
//                                        "actorUrl": "https://80000333.uat-e.fadada.com/connect?resourceUrl=https%3A%2F%2F80000333.uat-e.fadada.com%2Fapplication%2Ftask%2Fsign%2Fdetail%3FsignTaskId%3D1698220698273184241%26integrationCallbackUrl%3Dhttp%253A%252F%252F222.222.17.184%253A8991%252Fsignature%252Fcallback%253Fapi%253Dpub%252Fv1%252Ffasc%252FactorSignCallBack%26isFromApiIntegration%3Dtrue%26isFreeLogin%3D0%26partyId%3D1698220699000119393%26paramSign%3Db1552b911b8448933b1a25ede1c4109cb2374876459075e9f05d2ba8091bd3e2&userAccessTicket=bd699f77480c438eaf73498fd8ebe3fd", //签署连接
//                                        "informationId": 2 //合同模板ID
//                            },
//                                "message": "success"
//                            }
//                            String qrUrl = signatureWebInformationBean.getQrUrl();
//                            String actorUrl = signatureWebInformationBean.getActorUrl();
//                            String informationId = signatureWebInformationBean.getInformationId();
//                            //展示签署二维码
//                            method_show_QRCode_dialog(qrUrl);

                            PopTip.show(getResources().getString(R.string.signature_invalidated)).iconSuccess();

                            //作废成功，立即刷新该列表；
                            method_refresh_detail();


                        }
                    }, new ErrorConsumer() {

                        @Override
                        protected void error(ApiException apiException) {

                            CommUtils.checkMaterialDialog(materialDialog);
                            //页面报错；给提示
                            if (apiException != null) {
                                ToastUtils.showShort(apiException.getDisplayMessage());
                            }

                        }
                    });

        } else {

            ToastUtils.showShort(StringUtils.getString(R.string.http_exception_network));

        }


    }

    //生成客户签署二维码,是销售人员填写完毕了，给客户只做签字内容；
    private void gain_getFascActorQr(FileSignatureAgreement _fileSignatureAgreement, boolean _isRefreshQRCode, ImageView _imageViewQRCode_customer) {

        if (NetworkUtils.isConnected()) {

            HashMap<String, Object> map = new HashMap<>();
            map.put(Parameterkey.shopInfoId, mSession.getShopInfoId());
            map.put(Parameterkey.informationId, _fileSignatureAgreement.getInformationId());//合同模板ID

            AddLogUpLoadInfo addLogUpLoadInfo = new AddLogUpLoadInfo();
            addLogUpLoadInfo.setActivity(mActivityInstance);
            addLogUpLoadInfo.setWhat(ConstantApi.WHAT_GETFASCACTORQR_URL);//请求数字标识
            addLogUpLoadInfo.setUrlPath(ApiService.getFascActorQr_url);//url地址
            addLogUpLoadInfo.setRequestMethod(ConstantSign.REQUEST_METHOD_POST);//POST 或者 GET
            addLogUpLoadInfo.setToastToUser(false);//展示给用户的标志
            addLogUpLoadInfo.setHashMapParameter(map);

            NetworkManager.getInstance().initRetrofitRxJava()
                    .create(ApiService.class)
                    .getFascActorQr(RequestBody.create(JSON.toJSONString(map, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue),
                            MediaType.parse(ApiService.HEADER_JSON)))
                    .compose(SignatureDetailActivity.this.bindUntilEvent(ActivityEvent.DESTROY))//
                    .compose(new ResponseTransformer<>(addLogUpLoadInfo, new ApiRequestSubListener<SignatureWebInformationBean>() {
                        @Override
                        public void handlerSomeThingNotSuccessDataForItSelf(int what_method, String serverCode, String serverMessage) {
                            super.handlerSomeThingNotSuccessDataForItSelf(what_method, serverCode, serverMessage);

                            CommUtils.checkMaterialDialog(materialDialog);

                            //{"data":"","message":"无更多数据","code":"29999"}
                            //这里要不要给提示？无更多数据
//                            if (!TextUtils.isEmpty(serverMessage)) {
//                                ToastUtils.showShort(serverMessage);
//                            }

                            if (!TextUtils.equals(serverCode, ConstantSign.RESPONSE_STRING_29999)) {

                                if (!TextUtils.isEmpty(serverMessage)) {
                                    ToastUtils.showShort(serverMessage);
                                }

                            } else {

                                CommUtils.checkDialog(mAlertView);
                                mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, serverMessage, true);
                                mAlertView.show();

                            }

                        }
                    })).doOnSubscribe(new Consumer<Disposable>() {
                        @Override
                        public void accept(Disposable disposable) throws Throwable {
                            method_create_materialDialog(mActivityInstance, ConstantSign.TIPS_LOADING);
                        }
                    }).subscribe(new Consumer<SignatureWebInformationBean>() {
                        @Override
                        public void accept(SignatureWebInformationBean signatureWebInformationBean) throws Throwable {

                            CommUtils.checkMaterialDialog(materialDialog);


//                            {
//                                "code": "20000",
//                                    "data": {
//                                        "qrUrl": "http://222.222.17.184:8990/resource/15144218047-签署二维码.jpg", //二维码地址
//                                        "actorUrl": "https://80000333.uat-e.fadada.com/connect?resourceUrl=https%3A%2F%2F80000333.uat-e.fadada.com%2Fapplication%2Ftask%2Fsign%2Fdetail%3FsignTaskId%3D1698220698273184241%26integrationCallbackUrl%3Dhttp%253A%252F%252F222.222.17.184%253A8991%252Fsignature%252Fcallback%253Fapi%253Dpub%252Fv1%252Ffasc%252FactorSignCallBack%26isFromApiIntegration%3Dtrue%26isFreeLogin%3D0%26partyId%3D1698220699000119393%26paramSign%3Db1552b911b8448933b1a25ede1c4109cb2374876459075e9f05d2ba8091bd3e2&userAccessTicket=bd699f77480c438eaf73498fd8ebe3fd", //签署连接
//                                        "informationId": 2 //合同模板ID
//                            },
//                                "message": "success"
//                            }

                            String qrUrl = signatureWebInformationBean.getQrUrl();

                            String actorUrl = signatureWebInformationBean.getActorUrl();

                            String informationId = signatureWebInformationBean.getInformationId();

                            //展示签署二维码和发送二维码签署链接是一起的；
                            if (_isRefreshQRCode) {

                                LogUtils.d(ConstantSign.LOGCAT_NOMAL + "执行了【刷新】逻辑");

                                //如果是刷新二维码，那么弹窗是已经展开的，通知二维码的展示刷新
                                //发送消息 刷新二维码图片
                                if (_imageViewQRCode_customer != null) {

                                    Glide.with(SignatureDetailActivity.this)
                                            .load(qrUrl)
                                            .placeholder(R.drawable.icon_errorfang)//
                                            .error(R.drawable.icon_errorfang)//
                                            .fitCenter()
                                            .diskCacheStrategy(DiskCacheStrategy.NONE)//动态获取新值不缓存
                                            .into(_imageViewQRCode_customer);
                                }

                            } else {
                                //不是刷新二维码，是直接弹窗展示签署二维码给客户；
                                method_show_QRCode_dialog_to_customer(_fileSignatureAgreement, false, signatureWebInformationBean);
                            }

                            //原始代码 暂时不能废弃；
                            //method_show_QRCode_dialog(qrUrl);

                        }
                    }, new ErrorConsumer() {

                        @Override
                        protected void error(ApiException apiException) {

                            CommUtils.checkMaterialDialog(materialDialog);

                            //页面报错；给提示
                            if (apiException != null) {
                                ToastUtils.showShort(apiException.getDisplayMessage());
                            }

                        }
                    });

        } else {

            ToastUtils.showShort(StringUtils.getString(R.string.http_exception_network));

        }

    }

    //通用的刷新这个详情主页的内部小列表的状态；应该是每个弹窗的操作 都要执行；
    private void method_refresh_detail() {

        //单独的刷新 该合同详情主页
        EventSignatureDetail eventSignatureDetail = new EventSignatureDetail();
        eventSignatureDetail.setMessage(ExtraValue.EVENTBUS_EVENT_TO_REFRESH_SIGNATURE_DETAIL);
        EventBus.getDefault().post(eventSignatureDetail);

        //单独的刷新 档案盒子主页列表
        EventSignatureMain eventSignatureMainList = new EventSignatureMain();
        eventSignatureMainList.setMessage(ExtraValue.EVENTBUS_EVENT_TO_REFRESH_SIGNATURE_MAIN_LIST);
        EventBus.getDefault().post(eventSignatureMainList);

    }

    //客户签署二维码，给客户扫码或者签署链接 发给客户手机上
    private void method_show_QRCode_dialog_to_customer(FileSignatureAgreement _fileSignatureAgreement, boolean _isRefresh, SignatureWebInformationBean _signatureWebInformationBean) {

        //弹窗布局
//        View viewCard = View.inflate(mActivityInstance, R.layout.signature_create_dialog, null);
        View viewCard = View.inflate(mActivityInstance, R.layout.qrcodemiddlepopu_customer, null);

        if (viewCard != null) {

            //描述此二维码的标题
            TextView textViewQrName = (TextView) viewCard.findViewById(R.id.textviewqrname_customer);
            //填充房间号的名称内容
//          textViewQrName.setText(_siteNo);
            //刷新二维码的接口，也就是重新获取给客户展示签署的二维码
            TextView tv_refpopu_customer = (TextView) viewCard.findViewById(R.id.tv_refpopu_customer);
            //二维码图片展示用的
            ImageView imageViewPaintbookingQRCode_customer = (ImageView) viewCard.findViewById(R.id.imageviewpaintbookingqrcode_customer);

            String imagePathFolder = PathUtils.getExternalAppFilesPath() + File.separator + ConstantSign.DOWNAPP;
            FileUtils.createOrExistsDir(imagePathFolder);

            //FileUtils.createOrExistsFile(imagePathFolder);
            String imagePathFile = PathUtils.getExternalAppFilesPath() + File.separator + ConstantSign.DOWNAPP + File.separator + ConstantSign.IMG + TimeUtils.getNowString() + ConstantSign.IMG_POSTFIX;
            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "图片的本地路径是-->" + imagePathFile);
            //itchen-->图片的本地路径是-->/storage/emulated/0/Android/data/com.ygxsk.carhome/files/downapp/img2023-10-26 19:50:26.jpg
//            String testUrl = "http://222.222.17.184:8990/resource/image/houseTypeImg/20230818/2023081809380999347987.png";
            method_inside_download(_signatureWebInformationBean.getQrUrl(), imagePathFolder);

            //将图片下载到指定目录:
//            boolean resultValue = DemoImage.base64ToImage(_imageUrlBase64, imagePath);
//            //boolean resultValue = DemoImage.base64ToImage(_imageUrlBase64, PathUtils.getExternalAppFilesPath() + File.separator + ConstantSign.IMG + TimeUtils.getNowString() + ConstantSign.IMG_POSTFIX);

            //刷新二维码的按钮内容，本质：重新加载一次图片
            tv_refpopu_customer.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    //点击右上角的刷新
                    gain_getFascActorQr(_fileSignatureAgreement, true, imageViewPaintbookingQRCode_customer);
                }
            });

            Glide.with(SignatureDetailActivity.this)
                    .load(_signatureWebInformationBean.getQrUrl())
                    .placeholder(R.drawable.icon_errorfang)//
                    .error(R.drawable.icon_errorfang)//
                    .fitCenter()
                    .diskCacheStrategy(DiskCacheStrategy.NONE)//动态获取新值不缓存
//                        .override(120, 60)
                    .into(imageViewPaintbookingQRCode_customer);

//                点击查看大图
            if (imageViewPaintbookingQRCode_customer != null) {
                imageViewPaintbookingQRCode_customer.setOnClickListener(new ClickUtils.OnDebouncingClickListener() {
                    @Override
                    public void onDebouncingClick(View v) {
                        //验证码的查看大图
                        new XPopup.Builder(SignatureDetailActivity.this)
                                .asImageViewer(imageViewPaintbookingQRCode_customer, //
                                        _signatureWebInformationBean.getQrUrl(),//直接展示动态链接图，或者静态图也可以
                                        new SmartGlideImageLoader())//
                                .show();
                    }
                });
            }

            //关闭 按钮
            RoundTextView textViewCardCancel = (RoundTextView) viewCard.findViewById(R.id.textviewsignaturecancel_customer);
            //认证二维码的按钮
//          RoundTextView textViewToSignatureQRCodeCreate = (RoundTextView) viewCard.findViewById(R.id.textviewtosignatureqrcodecreate);
            //发送签署 链接到客户手机上
            RoundTextView textViewToSignatureLinksCreate = (RoundTextView) viewCard.findViewById(R.id.textviewtosignaturelinks_customer);

            //关闭这个弹窗的按钮逻辑
            if (textViewCardCancel != null) {

                textViewCardCancel.setOnClickListener(new ClickUtils.OnDebouncingClickListener() {
                    @Override
                    public void onDebouncingClick(View v) {

                        //此时 弹窗是已经被弹出的
                        if (materialDialogCustomView != null) {
                            materialDialogCustomView.dismiss();
                        }

                        //直接关闭该页面整体的,因为不认证是没法儿用的
                        //可能用户 正在当面认证，认证完毕之后， 销售经理直接关闭，就立即刷新页面
                        method_refresh_detail();

                    }
                });

            }

            //发送 签署链接 给用户，让用户签署
            if (textViewToSignatureLinksCreate != null) {
                textViewToSignatureLinksCreate.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {

                        gain_sendFascActorUrl(_fileSignatureAgreement);

                    }
                });
            }

            //激发 弹窗弹出内容
            materialDialogCustomView = new MaterialDialog.Builder(SignatureDetailActivity.this)
                    .customView(viewCard, false)
                    .contentColor(ColorUtils.getColor(R.color.buttonnomcolor))//
                    //.positiveText("确定")
                    .positiveColor(ColorUtils.getColor(R.color.dark))
                    //.negativeText("取消")
                    .canceledOnTouchOutside(false)
                    .show();


        }

    }

    //客户签署二维码，给客户扫码或者签署链接 发给客户手机上
    private void method_show_QRCode_dialog_to_manager(FileSignatureAgreement _fileSignatureAgreement, boolean _isRefresh, SignatureWebInformationBean _signatureWebInformationBean) {

        View viewCard = View.inflate(mActivityInstance, R.layout.qrcodemiddlepopu_manager, null);

        if (viewCard != null) {

            //描述此二维码的标题
            TextView textViewQrName = (TextView) viewCard.findViewById(R.id.textviewqrname_manager);
            //填充房间号的名称内容
//          textViewQrName.setText(_siteNo);

            //刷新二维码的接口，也就是重新获取给客户展示签署的二维码
            TextView tv_refpopu_manager = (TextView) viewCard.findViewById(R.id.tv_refpopu_manager);

            //二维码图片展示用的
            ImageView imageViewPaintbookingQRCode_manager = (ImageView) viewCard.findViewById(R.id.imageviewpaintbookingqrcode_manager);

            String imagePathFolder = PathUtils.getExternalAppFilesPath() + File.separator + ConstantSign.DOWNAPP;
            FileUtils.createOrExistsDir(imagePathFolder);

            //FileUtils.createOrExistsFile(imagePathFolder);
            String imagePathFile = PathUtils.getExternalAppFilesPath() + File.separator + ConstantSign.DOWNAPP + File.separator + ConstantSign.IMG + TimeUtils.getNowString() + ConstantSign.IMG_POSTFIX;
            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "图片的本地路径是-->" + imagePathFile);
            //itchen-->图片的本地路径是-->/storage/emulated/0/Android/data/com.ygxsk.carhome/files/downapp/img2023-10-26 19:50:26.jpg
//            String testUrl = "http://222.222.17.184:8990/resource/image/houseTypeImg/20230818/2023081809380999347987.png";
            method_inside_download(_signatureWebInformationBean.getQrUrl(), imagePathFolder);

            //将图片下载到指定目录:
//            boolean resultValue = DemoImage.base64ToImage(_imageUrlBase64, imagePath);
//            //boolean resultValue = DemoImage.base64ToImage(_imageUrlBase64, PathUtils.getExternalAppFilesPath() + File.separator + ConstantSign.IMG + TimeUtils.getNowString() + ConstantSign.IMG_POSTFIX);

            //刷新二维码的按钮内容，本质：重新加载一次图片
            tv_refpopu_manager.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    //点击右上角的刷新
                    gain_getFascManagerAuthUrl(_fileSignatureAgreement, true, imageViewPaintbookingQRCode_manager);
                }
            });

            Glide.with(SignatureDetailActivity.this)
                    .load(_signatureWebInformationBean.getQrUrl())
                    .placeholder(R.drawable.icon_errorfang)//
                    .error(R.drawable.icon_errorfang)//
                    .fitCenter()
                    .diskCacheStrategy(DiskCacheStrategy.NONE)//动态获取新值不缓存
                    .into(imageViewPaintbookingQRCode_manager);

//                点击查看大图
            if (imageViewPaintbookingQRCode_manager != null) {
                imageViewPaintbookingQRCode_manager.setOnClickListener(new ClickUtils.OnDebouncingClickListener() {
                    @Override
                    public void onDebouncingClick(View v) {
                        //验证码的查看大图
                        new XPopup.Builder(SignatureDetailActivity.this)
                                .asImageViewer(imageViewPaintbookingQRCode_manager, //
                                        _signatureWebInformationBean.getQrUrl(),//直接展示动态链接图，或者静态图也可以
                                        new SmartGlideImageLoader())//
                                .show();
                    }
                });
            }

            //关闭 按钮
            RoundTextView textViewCardCancel = (RoundTextView) viewCard.findViewById(R.id.textviewsignaturecancel_manager);
            //认证二维码的按钮
//          RoundTextView textViewToSignatureQRCodeCreate = (RoundTextView) viewCard.findViewById(R.id.textviewtosignatureqrcodecreate);
            //复制签署链接 给经理 确认签署
            RoundTextView textViewToSignatureLinksCreate = (RoundTextView) viewCard.findViewById(R.id.textviewtosignaturelinks_manager);

            //关闭这个弹窗的按钮逻辑
            if (textViewCardCancel != null) {

                textViewCardCancel.setOnClickListener(new ClickUtils.OnDebouncingClickListener() {
                    @Override
                    public void onDebouncingClick(View v) {

                        //此时 弹窗是已经被弹出的
                        if (materialDialogCustomView != null) {
                            materialDialogCustomView.dismiss();
                        }

                        //直接关闭该页面整体的,因为不认证是没法儿用的
                        //客户当面 签署完毕之后，也要刷新
                        method_refresh_detail();

                    }
                });

            }

            //发送 签署链接 给用户，让用户签署
            if (textViewToSignatureLinksCreate != null) {
                textViewToSignatureLinksCreate.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {

                        CommUtils.methodCopyClip(_signatureWebInformationBean.getActorUrl(), true);

                    }
                });
            }

            //激发 弹窗弹出内容
            materialDialogCustomView = new MaterialDialog.Builder(SignatureDetailActivity.this)
                    .customView(viewCard, false)
                    .contentColor(ColorUtils.getColor(R.color.buttonnomcolor))//
                    //.positiveText("确定")
                    .positiveColor(ColorUtils.getColor(R.color.dark))
                    //.negativeText("取消")
                    .canceledOnTouchOutside(false)
                    .show();


        }

    }

    //直接打开文件的路径，打开文件,2023-10-27 09:04:42 我指定的是打开文件夹：
    private void methodOpenImage(String _imagePathFolder) {

        //直接打开到文件夹
        final ZFileConfiguration configuration = new ZFileConfiguration.Build()
                .filePath(PathUtils.getExternalAppFilesPath() + File.separator + ConstantSign.DOWNAPP + File.separator)
                .boxStyle(ZFileConfiguration.STYLE2)
//                .sortordBy(ZFileConfiguration.BY_DEFAULT)
                .sortordBy(ZFileConfiguration.BY_DATE)//按照日期的顺序排序
                .sortord(ZFileConfiguration.DESC)//倒序排列
                .maxLength(1)
                .maxLengthStr("最多选1个！")
                .useSAF(false)
                .build();

        ZFileContent.getZFileHelp()
                .setConfiguration(configuration)
                .start(SignatureDetailActivity.this);

    }

    //直接执行下载
    private void method_inside_download(String _downLoadUrlCurrent, String _imagePathLocal) {

        //使用第三方下载
        taskDownLoadApkId = Aria.download(this)
                .load(_downLoadUrlCurrent)
                .setFilePath(_imagePathLocal) //设置文件保存的完整路径,我设置的全路径
                .create();   //启动下载


//        2023-11-01 13:47:23.785 6910-6910/com.ygxsk.carhome E/CheckDEntityUtil:
//        下载失败，保存路径【/storage/emulated/0/Android/data/com.ygxsk.carhome/files/downapp】不能为文件夹，路径需要是完整的文件路径，如：/mnt/sdcard/game.zip

    }

    //在这里处理任务执行中的状态，如进度进度条的刷新
    @Download.onTaskRunning
    protected void running(DownloadTask task) {

//        if(task.getKey().eques(task.getKey())){
//        ....
//            可以通过url判断是否是指定任务的回调
//        }
        int p = task.getPercent();  //任务进度百分比
//        String speed = task.getConvertSpeed();  //转换单位后的下载速度，单位转换需要在配置文件中打开
//        String speed1 = String.valueOf(task.getSpeed()); //原始byte长度速度
//        LogUtils.d(ConstantSign.LOGCAT_NOMAL+"下载进度是-->"+speed);
//        LogUtils.d(ConstantSign.LOGCAT_NOMAL + "下载进度是-->" + p);

//        if (callbackResult != null) {
//            callbackResult.OnBackResult(p);
//        }

    }

    @Download.onTaskComplete
    void taskComplete(DownloadTask task) {
        //在这里处理任务完成的状态
        //下载完毕
        LogUtils.d(ConstantSign.LOGCAT_NOMAL + "下载完毕；");
        //String filePath = PathUtils.getExternalAppCachePath() + File.separator + (_downLoadUrlCurrent.substring(_downLoadUrlCurrent.lastIndexOf("/") + 1));
        LogUtils.d(ConstantSign.LOGCAT_NOMAL + "下载完毕后的地址-->" + task.getFilePath());
        //itchen-->下载完毕后的地址-->/storage/emulated/0/Android/data/com.ygxsk.carhome/files/downapp/img2023-10-27 08:54:36.jpg

        //直接启用安装
//        if (!TextUtils.isEmpty(task.getFilePath())) {
//            if (CommUtils.getUninatllApkInfo(LoginCarActivity.this, task.getFilePath())) {
//                ///data/user/0/com.ygxsk.integrated/cache/2970b8290303428eb08f0805be10db3d.apk
//                AppUtils.installApp(task.getFilePath());
//            }
//        }

    }

    @Download.onTaskCancel
    void taskCancel(DownloadTask task) {

        //LogUtils.d(ConstantSign.LOGCAT_NOMAL+"---->下载取消---");

        //mAdapter.updateState(task.getEntity());
        //判断这个任务在运行的状态中，那么，就直接停止它；
//        if (Aria.download(SettingActivity.this).load(taskDownLoadApkId).isRunning()){
//            Aria.download(SettingActivity.this).load(taskDownLoadApkId).stop();
//        }

        //直接关闭 下载弹窗；
        //立即关闭弹窗的
//        CommUtils.checkMaterialDialog(materialDialogHasUpdateData);
//        CommUtils.checkMaterialDialog(materialDialogDownLoadProgress);

        ToastUtils.showLong(R.string.downlaodappcancel);

    }

    /**
     * @param e 异常信息
     */
    @Download.onTaskFail
    void taskFail(DownloadTask task, Exception e) {

        //立即关闭弹窗的
//        CommUtils.checkMaterialDialog(materialDialogHasUpdateData);
//        CommUtils.checkMaterialDialog(materialDialogDownLoadProgress);

        //ALog.d(TAG, ALog.getExceptionString(e));
        //下载任务失败
        //下载失败
        if (!TextUtils.isEmpty(ALog.getExceptionString(e))) {

            ToastUtils.showShort(ALog.getExceptionString(e));

            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "---->下载报错--->" + ALog.getExceptionString(e));

            //提示下载失败：
            ToastUtils.showShort(ALog.getExceptionString(e));
        }
    }


    //弹窗的操作：客户认证二维码或者是；
    private void method_show_QRCode_dialog(String _title, String _imageUrl) {

        View viewCard = View.inflate(mActivityInstance, R.layout.qrcodemiddlepopu, null);

        if (viewCard != null) {

            //暂时没有标题？
            TextView textViewQrName = (TextView) viewCard.findViewById(R.id.textviewqrname);
            //弹窗的标题内容
            TextView textNamePopu = (TextView) viewCard.findViewById(R.id.tv_namepopu);
//            textNamePopu.setText("认证二维码");
//            textNamePopu.setText("经理签署二维码");
            textNamePopu.setText(_title);
            //填充房间号的名称内容
//           textViewQrName.setText(_siteNo);

            //图片的内容  imageviewpaintbookingqrcode
            ImageView imageViewQRCode = (ImageView) viewCard.findViewById(R.id.imageviewpaintbookingqrcode);
            //关闭 按钮
            RoundTextView textViewCardCancel = (RoundTextView) viewCard.findViewById(R.id.textviewqrcodecancel);
            //保存为图片的按钮
            RoundTextView textViewCardSure = (RoundTextView) viewCard.findViewById(R.id.textviewqrcodesave);
            //友盟分享的内容
//           RoundTextView textViewQrcodeShare = (RoundTextView) viewCard.findViewById(R.id.textViewQrcodeShare);
//
            String imagePathFolder = PathUtils.getExternalAppFilesPath() + File.separator + ConstantSign.DOWNAPP;
            FileUtils.createOrExistsDir(imagePathFolder);
            //FileUtils.createOrExistsFile(imagePathFolder);
            String imagePathFile = PathUtils.getExternalAppFilesPath() + File.separator + ConstantSign.DOWNAPP + File.separator + ConstantSign.IMG + TimeUtils.getNowString() + ConstantSign.IMG_POSTFIX;
            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "图片的本地路径是-->" + imagePathFile);
            //itchen-->图片的本地路径是-->/storage/emulated/0/Android/data/com.ygxsk.carhome/files/downapp/img2023-10-26 19:50:26.jpg
//            String testUrl = "http://222.222.17.184:8990/resource/image/houseTypeImg/20230818/2023081809380999347987.png";
            method_inside_download(_imageUrl, imagePathFile);

            //将图片下载到指定目录:
//            boolean resultValue = DemoImage.base64ToImage(_imageUrlBase64, imagePath);
//            //boolean resultValue = DemoImage.base64ToImage(_imageUrlBase64, PathUtils.getExternalAppFilesPath() + File.separator + ConstantSign.IMG + TimeUtils.getNowString() + ConstantSign.IMG_POSTFIX);

            Glide.with(SignatureDetailActivity.this)
                    .load(_imageUrl)
                    .placeholder(R.drawable.icon_errorfang)//
                    .error(R.drawable.icon_errorfang)//
                    .fitCenter()
                    .diskCacheStrategy(DiskCacheStrategy.NONE)//动态获取新值不缓存
//                        .override(120, 60)
                    .into(imageViewQRCode);

//                点击查看大图
            if (imageViewQRCode != null) {
                imageViewQRCode.setOnClickListener(new ClickUtils.OnDebouncingClickListener() {
                    @Override
                    public void onDebouncingClick(View v) {
                        //验证码的查看大图
                        new XPopup.Builder(SignatureDetailActivity.this)
                                .asImageViewer(imageViewQRCode, //
                                        _imageUrl,//直接展示动态链接图，或者静态图也可以
                                        new SmartGlideImageLoader())//
                                .show();
                    }
                });
            }

            //关闭弹窗
            if (textViewCardCancel != null) {
                textViewCardCancel.setOnClickListener(new ClickUtils.OnDebouncingClickListener() {
                    @Override
                    public void onDebouncingClick(View v) {

                        //此时 弹窗是已经被弹出的
                        if (materialDialogCustomView != null) {
                            materialDialogCustomView.dismiss();
                        }

                        //2023年11月2日11:45:31 确认：客户浏览器扫码填写完自己的认证信息，通过之后，销售经理点击【关闭】，
                        //那么要立即刷新列表，因为状态变了；
                        method_refresh_detail();

                    }
                });
            }

            //点击打开图片的时候就关闭弹窗：
            if (textViewCardSure != null) {

                textViewCardSure.setOnClickListener(new ClickUtils.OnDebouncingClickListener() {
                    @Override
                    public void onDebouncingClick(View v) {


                        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {

                            //获取权限
                            if (!AndPermission.hasPermissions(mActivityInstance, Permission.WRITE_EXTERNAL_STORAGE)
                                    || !AndPermission.hasPermissions(mActivityInstance, Permission.READ_EXTERNAL_STORAGE)) {

                                CommUtils.checkMaterialDialog(materialDialog);

                                materialDialog = CommUtils.authorityRequest(mActivityInstance, ConstantSign.MATERIALDIALOG_AUTHORITY_CONTENT_STORAGE, new AuthorityCallbackListener() {
                                    @Override
                                    public void doSomeThing() {

                                        CommUtils.checkMaterialDialog(materialDialog);

                                        //添加访问权限内容
                                        AndPermission.with(SignatureDetailActivity.this)
                                                .runtime()//
                                                .permission(Permission.READ_EXTERNAL_STORAGE, //
                                                        Permission.WRITE_EXTERNAL_STORAGE)//
                                                .rationale(new RuntimeRationale())//
                                                .onGranted(new com.yanzhenjie.permission.Action<List<String>>() {
                                                    @Override
                                                    public void onAction(List<String> permissions) {

                                                        if (materialDialogCustomView != null) {
                                                            materialDialogCustomView.dismiss();
                                                        }


                                                        methodOpenImage(imagePathFolder);

                                                    }
                                                }).onDenied(new com.yanzhenjie.permission.Action<List<String>>() {
                                                    @Override
                                                    public void onAction(List<String> permissions) {

                                                        ToastUtils.showShort(ConstantSign.NEEDPERMISS_PHONE);

                                                        PermissionSetting permissionSetting = new PermissionSetting(mActivityInstance);

                                                        if (AndPermission.hasAlwaysDeniedPermission(SignatureDetailActivity.this, permissions)) {
                                                            permissionSetting.showSetting(ConstantApi.PERMISSION_NORMAL, SignatureDetailActivity.this, permissions);
                                                        }

                                                    }
                                                }).start();

                                    }
                                });

                            } else {

                                if (materialDialogCustomView != null) {
                                    materialDialogCustomView.dismiss();
                                }

                                methodOpenImage(imagePathFolder);

                            }


                        } else {

                            if (!XXPermissions.isGranted(SignatureDetailActivity.this, com.hjq.permissions.Permission.READ_MEDIA_IMAGES)) {

                                CommUtils.checkMaterialDialog(materialDialog);

                                materialDialog = CommUtils.authorityRequest(mActivityInstance, ConstantSign.MATERIALDIALOG_AUTHORITY_CONTENT_ALBUM, new AuthorityCallbackListener() {

                                    @Override
                                    public void doSomeThing() {

                                        CommUtils.checkMaterialDialog(materialDialog);

                                        XXPermissions.with(SignatureDetailActivity.this)
                                                // 适配分区存储应该这样写
                                                //.permission(Permission.Group.STORAGE)
                                                // 不适配分区存储应该这样写
//                                                        .permission(com.hjq.permissions.Permission.MANAGE_EXTERNAL_STORAGE)//
                                                .permission(com.hjq.permissions.Permission.READ_MEDIA_IMAGES)//
                                                .interceptor(new PermissionInterceptor())
                                                .request(new OnPermissionCallback() {

                                                    @Override
                                                    public void onGranted(@NonNull List<String> permissions, boolean allGranted) {

                                                        if (!allGranted) {
                                                            return;
                                                        }

                                                        Toaster.show(String.format(getString(R.string.demo_obtain_permission_success_hint),
                                                                PermissionNameConvert.getPermissionString(SignatureDetailActivity.this, permissions)));

                                                        if (materialDialogCustomView != null) {
                                                            materialDialogCustomView.dismiss();
                                                        }

                                                        methodOpenImage(imagePathFolder);

                                                    }
                                                });

                                    }
                                });


                            }
                        }

                    }
                });
            }

            //激发 弹窗弹出内容
            materialDialogCustomView = new MaterialDialog.Builder(SignatureDetailActivity.this)
                    .customView(viewCard, false)
                    .contentColor(ColorUtils.getColor(R.color.buttonnomcolor))//
                    //.positiveText("确定")
                    .positiveColor(ColorUtils.getColor(R.color.dark))
                    //.negativeText("取消")
                    .canceledOnTouchOutside(false)
                    .show();

            //materialDialog.getTitleView().setTextSize(16f);

        }

    }

//    //发起签约,的生成认证二维码，给客户扫码 填写客户自己的认证
//    private void gain_create_signature(String _phoneNumber) {
//
//        //clientPhone_upLoad = editViewPhoneEvaluate.getText().toString().trim();
//
//        if (NetworkUtils.isConnected()) {
//
//            HashMap<String, Object> map = new HashMap<>();
//            map.put(Parameterkey.shopInfoId, mSession.getShopInfoId());//,
//            map.put(Parameterkey.clientPhone, _phoneNumber);//,客户手机号
//            map.put(Parameterkey.clientType, clientType_upLoad);//,clientType 客户类型(0:个人;1:企业),默认是个人
//            map.put(Parameterkey.archiveTypeId, archiveTypeId_upLoad);//档案的类型，是新车 还是二手车
//
//            AddLogUpLoadInfo addLogUpLoadInfo = new AddLogUpLoadInfo();
//            addLogUpLoadInfo.setActivity(mActivityInstance);
//            addLogUpLoadInfo.setWhat(ConstantApi.WHAT_CHECKOPENFASC_URL);//请求数字标识
//            addLogUpLoadInfo.setUrlPath(ApiService.checkOpenFasc_url);//url地址
//            addLogUpLoadInfo.setRequestMethod(ConstantSign.REQUEST_METHOD_POST);//POST 或者 GET
//            addLogUpLoadInfo.setToastToUser(true);//展示给用户的标志
//            addLogUpLoadInfo.setHashMapParameter(map);
//
//            NetworkManager.getInstance().initRetrofitRxJava()
//                    .create(ApiService.class)
//                    .getFascAuthQr(RequestBody.create(JSON.toJSONString(map, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue),
//                            MediaType.parse(ApiService.HEADER_JSON)))
//                    .compose(SignatureDetailActivity.this.bindUntilEvent(ActivityEvent.DESTROY))//
//                    .compose(new ResponseTransformer<>(addLogUpLoadInfo, new ApiRequestSubListener<SignatureWebInformationBean>() {
//                        @Override
//                        public void handlerSomeThingNotSuccessDataForItSelf(int what_method, String serverCode, String serverMessage) {
//                            super.handlerSomeThingNotSuccessDataForItSelf(what_method, serverCode, serverMessage);
//                            //{"data":"","message":"无更多数据","code":"29999"}
//                            CommUtils.checkMaterialDialog(materialDialog);
//
//                            //这里要不要给提示？无更多数据
//                            if (!TextUtils.isEmpty(serverMessage)) {
//                                ToastUtils.showShort(serverMessage);
//                            }
//
//                        }
//                    })).doOnSubscribe(new Consumer<Disposable>() {
//                        @Override
//                        public void accept(Disposable disposable) throws Throwable {
//                            method_create_materialDialog(ConstantSign.TIPS_SUBMIT);
//                        }
//                    }).subscribe(new Consumer<SignatureWebInformationBean>() {
//                        @Override
//                        public void accept(SignatureWebInformationBean signatureWebInformationBean) throws Throwable {
//
////                            {
////                                "code": "20000",
////                                    "data": {
////                                        "authUrl": "https://80000333.uat-e.fadada.com/authorizeui/person/login?authSerial=2dedef36d279452d82ed3cadb1d2dd7f", //法大大认证连接
////                                        "qrUrl": "http://222.222.17.184:8990/resource/15144218047-1499.jpg", //认证二维码图片地址
////                                        "informationId": 2 //合同档案ID
////                                 },
////                                "message": "success"
////                            }
//
//
//                            //真实接口
////                            {
////                                "code":"20000",
////                                        "data":{
////                                        "authUrl":"https://80000333.uat-e.fadada.com/authorizeui/person/login?authSerial=59e8e4a8223640659f64a056dbf3334a",
////                                        "qrUrl":"http://222.222.17.184:8990/resource/17531108969-1495认证二维码.jpg",
////                                        "informationId":3
////                            },
////                                "message":"success"
////                            }
//
//                            CommUtils.checkMaterialDialog(materialDialog);
//
//                            // TODO: 2023-10-26 18:25 存入本地 做接口携带用到；
//                            //存入 informationId 的值内容；
//                            String informationId = signatureWebInformationBean.getInformationId();
//                            mSession.setInformationId(informationId);
//
//                            //MMKV.defaultMMKV().encode(ConstantSign.P_INFORMATIONID, informationId);
//
//                            //链接的地址信息
//                            String authUrl = signatureWebInformationBean.getAuthUrl();
//
//                            // TODO: 2023-10-26 18:24  获取到二维码链接 怎么用呢？
//                            //二维码的地址信息  ?怎么用呢？
//                            String qrUrl = signatureWebInformationBean.getQrUrl();
//
////                            if (!TextUtils.isEmpty(informationId)) {
////                                //怎么用？
////                            }
//
//                            if (!TextUtils.isEmpty(qrUrl)) {
//
//                                PopTip.show(getResources().getString(R.string.send_links_to_qrcode)).iconSuccess();
//
//                                method_show_QRCode_dialog(qrUrl);
//
//                            }
//                        }
//                    }, new ErrorConsumer() {
//
//                        @Override
//                        protected void error(ApiException apiException) {
//
//                            CommUtils.checkMaterialDialog(materialDialog);
//
//                            //页面报错；给提示
//                            if (apiException != null) {
//                                ToastUtils.showShort(apiException.getDisplayMessage());
//                            }
//
//                        }
//                    });
//
//        } else {
//
//            ToastUtils.showShort(StringUtils.getString(R.string.http_exception_network));
//
//        }
//
//
//    }

    //客户类型   客户类型(0:个人;1:企业),默认是个人,默认是个人
    private String clientType_upLoad = "0";
    //合同的类别  新车  二手车 ？
    private String archiveTypeId_upLoad;
    //客户手机号内容
    private String clientPhone_upLoad;
    private ClearEditText editViewPhoneEvaluate;

    //【发起签约】的二维码信息，
    private void method_create_signature_dialog() {

        //弹窗布局
        View viewCard = View.inflate(mActivityInstance, R.layout.signature_create_dialog, null);

        if (viewCard != null) {

            //标题 卡券的
            TextView textViewQrName = (TextView) viewCard.findViewById(R.id.tv_name_signature_popu_title);

            //填充房间号的名称内容
//            textViewQrName.setText(_siteNo);

            //用户手机号内容
            editViewPhoneEvaluate = (ClearEditText) viewCard.findViewById(R.id.editviewphoneevaluate);

            if (extra_fileSignatureManage != null) {
                //如果携带不是空，并且手机号也  不论是不是空都填充，是空就算了
                editViewPhoneEvaluate.setText(extra_fileSignatureManage.getClientPhone());
            }


            RadioGroup radioGroupCustomerType = (RadioGroup) viewCard.findViewById(R.id.radiogroupcustomertype);
            RadioGroup radioGroupVehicleType = (RadioGroup) viewCard.findViewById(R.id.radiogroupvehicletype);

            //合同类型 默认是新车
            archiveTypeId_upLoad = SignatureVehicleType.VEHICLETYPE_CAR_NEW.getIndex();
            //默认的类型是 个人类型
            clientType_upLoad = SignatureClientType.CLIENTTYPE_PERSON.getIndex();

            //个人用户或者企业用户
            radioGroupCustomerType.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
                @Override
                public void onCheckedChanged(RadioGroup group, int checkedId) {

//                    public enum SignatureClientType {
//                        //客户类型(0:个人;1:企业),默认是个人
//                        CLIENTTYPE_PERSON("0"),
//                        CLIENTTYPE_COMPANY("1");

                    if (checkedId == R.id.radiobuttoncustomertypeperson) {

                        //客户类型(0:个人;1:企业),默认是个人
                        clientType_upLoad = SignatureClientType.CLIENTTYPE_PERSON.getIndex();

                    } else if (checkedId == R.id.radiobuttoncustomertypecompany) {

                        clientType_upLoad = SignatureClientType.CLIENTTYPE_COMPANY.getIndex();

                    }


                }
            });

            //合同类型 是新车或者是二手车
            radioGroupVehicleType.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
                @Override
                public void onCheckedChanged(RadioGroup group, int checkedId) {

//                    public enum SignatureVehicleType {
//                        //车辆类型  1新车  2二手车
//                        VEHICLETYPE_CAR_NEW("1"),
//                        VEHICLETYPE_CAR_OLD("2");

                    if (checkedId == R.id.radiobuttonvehicletypecarnew) {

                        archiveTypeId_upLoad = SignatureVehicleType.VEHICLETYPE_CAR_NEW.getIndex();

                    } else if (checkedId == R.id.radiobuttonvehicletypecarold) {

                        archiveTypeId_upLoad = SignatureVehicleType.VEHICLETYPE_CAR_OLD.getIndex();
                    }

                }
            });


            //关闭 按钮
            RoundTextView textViewCardCancel = (RoundTextView) viewCard.findViewById(R.id.textviewsignaturecancelcreate);
            //认证二维码的按钮
            RoundTextView textViewToSignatureQRCodeCreate = (RoundTextView) viewCard.findViewById(R.id.textviewtosignatureqrcodecreate);
            //认证链接
            RoundTextView textViewToSignatureLinksCreate = (RoundTextView) viewCard.findViewById(R.id.textviewtosignaturelinkscreate);


            if (textViewCardCancel != null) {
                textViewCardCancel.setOnClickListener(new ClickUtils.OnDebouncingClickListener() {
                    @Override
                    public void onDebouncingClick(View v) {

                        //此时 弹窗是已经被弹出的
                        if (materialDialogCustomView != null) {
                            materialDialogCustomView.dismiss();
                        }

                        //直接关闭该页面整体的,因为不认证是没法儿用的
                        //methodBack();

                    }
                });
            }


            if (textViewToSignatureQRCodeCreate != null) {

                textViewToSignatureQRCodeCreate.setOnClickListener(new ClickUtils.OnDebouncingClickListener() {
                    @Override
                    public void onDebouncingClick(View v) {

                        //打开浏览器的逻辑，是不可行的，放弃；因为交互信息 后台无法给到手机端
                        //CommUtils.linkJumpDialogSignature(SignatureActivity.this, SignatureActivity.this, _contentResult);

                        //应该是打开内部的webView才可以；可以实现法大大给认证结果给H5，下一步Android和H5交互,这样手机端才知道认证成功；
//                        ViewUitls.method_toWebView_signature(getString(R.string.title_dialog_signature), _contentResult);

                        clientPhone_upLoad = editViewPhoneEvaluate.getText().toString().trim();

                        // TODO: 2023-10-26 16:39 校验为空的手机号为空的
                        if (TextUtils.isEmpty(clientPhone_upLoad)) {
//                            CommUtils.checkDialog(mAlertView);
//                            mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getResources().getString(R.string.hint_input_phone), true);
//                            mAlertView.show();

//                            PopTip.show(getResources().getString(R.string.hint_input_phone)).iconWarning();

                            new MaterialDialog.Builder(mActivityInstance)
                                    .title(ConstantSign.ALERT_TITLE)
                                    .titleGravity(GravityEnum.CENTER)
                                    .content(getResources().getString(R.string.hint_input_phone))
                                    .contentGravity(GravityEnum.CENTER)
                                    .positiveText(getResources().getString(R.string.popubuttonclose))
                                    //.negativeText("取消")
                                    .show();

//                            TipDialog.show(getResources().getString(R.string.hint_input_phone), WaitDialog.TYPE.ERROR);

                            return;
                        }

                        //选择客户类型
                        if (TextUtils.isEmpty(clientType_upLoad)) {

//                            CommUtils.checkDialog(mAlertView);
//                            mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getResources().getString(R.string.dialog_select_clienttype), true);
//                            mAlertView.show();

//                            PopTip.show(getResources().getString(R.string.dialog_select_clienttype)).iconWarning();

                            new MaterialDialog.Builder(mActivityInstance)
                                    .title(ConstantSign.ALERT_TITLE)
                                    .titleGravity(GravityEnum.CENTER)
                                    .content(getResources().getString(R.string.dialog_select_clienttype))
                                    .contentGravity(GravityEnum.CENTER)
                                    .positiveText(getResources().getString(R.string.popubuttonclose))
                                    //.negativeText("取消")
                                    .show();

//                            TipDialog.show(getResources().getString(R.string.dialog_select_clienttype), WaitDialog.TYPE.ERROR);

                            return;
                        }

                        //选择合同类别
                        if (TextUtils.isEmpty(archiveTypeId_upLoad)) {

//                            CommUtils.checkDialog(mAlertView);
//                            mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getResources().getString(R.string.dialog_select_archivetypeId), true);
//                            mAlertView.show();

//                            PopTip.show(getResources().getString(R.string.dialog_select_archivetypeId)).iconWarning();

                            new MaterialDialog.Builder(mActivityInstance)
                                    .title(ConstantSign.ALERT_TITLE)
                                    .titleGravity(GravityEnum.CENTER)
                                    .content(getResources().getString(R.string.dialog_select_archivetypeId))
                                    .contentGravity(GravityEnum.CENTER)
                                    .positiveText(getResources().getString(R.string.popubuttonclose))
                                    //.negativeText("取消")
                                    .show();

//                            TipDialog.show(getResources().getString(R.string.dialog_select_archivetypeId), WaitDialog.TYPE.ERROR);

                            return;
                        }

                        //信息都填写完毕，提交，关闭该弹窗
                        if (materialDialogCustomView != null) {
                            materialDialogCustomView.dismiss();
                        }

                        //生成客户认证二维码：
                        gain_create_signature();


                    }
                });
            }


            //认证链接
            if (textViewToSignatureLinksCreate != null) {
                textViewToSignatureLinksCreate.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {

                        //发送认证链接
                        clientPhone_upLoad = editViewPhoneEvaluate.getText().toString().trim();

                        // TODO: 2023-10-26 16:39 校验为空的手机号为空的
                        if (TextUtils.isEmpty(clientPhone_upLoad)) {
//                            CommUtils.checkDialog(mAlertView);
//                            mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getResources().getString(R.string.hint_input_phone), true);
//                            mAlertView.show();

//                            PopTip.show(getResources().getString(R.string.hint_input_phone)).iconWarning();

                            new MaterialDialog.Builder(mActivityInstance)
                                    .title(ConstantSign.ALERT_TITLE)
                                    .titleGravity(GravityEnum.CENTER)
                                    .content(getResources().getString(R.string.hint_input_phone))
                                    .contentGravity(GravityEnum.CENTER)
                                    .positiveText(getResources().getString(R.string.popubuttonclose))
                                    //.negativeText("取消")
                                    .show();

//                            TipDialog.show(getResources().getString(R.string.hint_input_phone), WaitDialog.TYPE.ERROR);

                            return;
                        }

                        //选择客户类型
                        if (TextUtils.isEmpty(clientType_upLoad)) {
//                            CommUtils.checkDialog(mAlertView);
//                            mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getResources().getString(R.string.dialog_select_clienttype), true);
//                            mAlertView.show();

//                            PopTip.show(getResources().getString(R.string.dialog_select_clienttype)).iconWarning();

                            new MaterialDialog.Builder(mActivityInstance)
                                    .title(ConstantSign.ALERT_TITLE)
                                    .titleGravity(GravityEnum.CENTER)
                                    .content(getResources().getString(R.string.dialog_select_clienttype))
                                    .contentGravity(GravityEnum.CENTER)
                                    .positiveText(getResources().getString(R.string.popubuttonclose))
                                    //.negativeText("取消")
                                    .show();

//                            TipDialog.show(getResources().getString(R.string.dialog_select_clienttype), WaitDialog.TYPE.ERROR);

                            return;
                        }

                        //选择合同类别
                        if (TextUtils.isEmpty(archiveTypeId_upLoad)) {
//                            CommUtils.checkDialog(mAlertView);
//                            mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getResources().getString(R.string.dialog_select_archivetypeId), true);
//                            mAlertView.show();

//                            PopTip.show(getResources().getString(R.string.dialog_select_archivetypeId)).iconWarning();

                            new MaterialDialog.Builder(mActivityInstance)
                                    .title(ConstantSign.ALERT_TITLE)
                                    .titleGravity(GravityEnum.CENTER)
                                    .content(getResources().getString(R.string.dialog_select_archivetypeId))
                                    .contentGravity(GravityEnum.CENTER)
                                    .positiveText(getResources().getString(R.string.popubuttonclose))
                                    //.negativeText("取消")
                                    .show();

//                            TipDialog.show(getResources().getString(R.string.dialog_select_archivetypeId), WaitDialog.TYPE.ERROR);

                            return;
                        }

                        //信息都填写完毕，提交，关闭该弹窗
                        if (materialDialogCustomView != null) {
                            materialDialogCustomView.dismiss();
                        }

                        gain_send_signature_links_to_customer();

                    }
                });
            }

            //激发 弹窗弹出内容
            materialDialogCustomView = new MaterialDialog.Builder(SignatureDetailActivity.this)
                    .customView(viewCard, false)
                    .contentColor(ColorUtils.getColor(R.color.buttonnomcolor))//
                    //.positiveText("确定")
                    .positiveColor(ColorUtils.getColor(R.color.dark))
                    //.negativeText("取消")
                    .canceledOnTouchOutside(false)
                    .show();
        }

    }

    //发起签约,的生成认证二维码，给客户扫码 填写客户自己的认证
    private void gain_create_signature() {

        clientPhone_upLoad = editViewPhoneEvaluate.getText().toString().trim();

        if (NetworkUtils.isConnected()) {

            HashMap<String, Object> map = new HashMap<>();
            map.put(Parameterkey.shopInfoId, mSession.getShopInfoId());//
            map.put(Parameterkey.clientPhone, clientPhone_upLoad);//,客户手机号
            map.put(Parameterkey.clientType, clientType_upLoad);//,clientType 客户类型(0:个人;1:企业),默认是个人
            map.put(Parameterkey.archiveTypeId, archiveTypeId_upLoad);//档案的类型，是新车 还是二手车

            AddLogUpLoadInfo addLogUpLoadInfo = new AddLogUpLoadInfo();
            addLogUpLoadInfo.setActivity(mActivityInstance);
            addLogUpLoadInfo.setWhat(ConstantApi.WHAT_CHECKOPENFASC_URL);//请求数字标识
            addLogUpLoadInfo.setUrlPath(ApiService.checkOpenFasc_url);//url地址
            addLogUpLoadInfo.setRequestMethod(ConstantSign.REQUEST_METHOD_POST);//POST 或者 GET
            addLogUpLoadInfo.setToastToUser(false);//展示给用户的标志
            addLogUpLoadInfo.setHashMapParameter(map);

            NetworkManager.getInstance().initRetrofitRxJava()
                    .create(ApiService.class)
                    .getFascAuthQr(RequestBody.create(JSON.toJSONString(map, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue),
                            MediaType.parse(ApiService.HEADER_JSON)))
                    .compose(SignatureDetailActivity.this.bindUntilEvent(ActivityEvent.DESTROY))//
                    .compose(new ResponseTransformer<>(addLogUpLoadInfo, new ApiRequestSubListener<SignatureWebInformationBean>() {
                        @Override
                        public void handlerSomeThingNotSuccessDataForItSelf(int what_method, String serverCode, String serverMessage) {
                            super.handlerSomeThingNotSuccessDataForItSelf(what_method, serverCode, serverMessage);
                            //{"data":"","message":"无更多数据","code":"29999"}
                            CommUtils.checkMaterialDialog(materialDialog);

                            //这里要不要给提示？无更多数据
                            if (!TextUtils.isEmpty(serverMessage)) {
                                ToastUtils.showShort(serverMessage);
                            }

                        }
                    })).doOnSubscribe(new Consumer<Disposable>() {
                        @Override
                        public void accept(Disposable disposable) throws Throwable {
                            method_create_materialDialog(mActivityInstance, ConstantSign.TIPS_SUBMIT);
                        }
                    }).subscribe(new Consumer<SignatureWebInformationBean>() {
                        @Override
                        public void accept(SignatureWebInformationBean signatureWebInformationBean) throws Throwable {

                            CommUtils.checkMaterialDialog(materialDialog);

                            // : 2023-10-26 18:25 存入本地 做接口携带用到；
                            //存入 informationId 的值内容；
                            String informationId = signatureWebInformationBean.getInformationId();
                            mSession.setInformationId(informationId);

                            //MMKV.defaultMMKV().encode(ConstantSign.P_INFORMATIONID, informationId);

                            //链接的地址信息
                            String authUrl = signatureWebInformationBean.getAuthUrl();
                            // : 2023-10-26 18:24  获取到二维码链接  怎么用呢？
                            //二维码的地址信息  ?怎么用呢？
                            String qrUrl = signatureWebInformationBean.getQrUrl();
                            //
                            boolean fascAuth = signatureWebInformationBean.getFascAuth();

                            //判断该用户是否开通过法大大；如果开通过，就不弹出二维码，
                            //true 是否已经认证过法大大
                            if (fascAuth) {

                                //已开通过法大大


                            } else {
                                if (!TextUtils.isEmpty(qrUrl)) {
                                    PopTip.show(getResources().getString(R.string.send_links_to_qrcode)).iconSuccess();
                                    method_show_QRCode_dialog(getResources().getString(R.string.signature_send_qrcode_customer), qrUrl);
                                }

                            }
                        }
                    }, new ErrorConsumer() {

                        @Override
                        protected void error(ApiException apiException) {

                            CommUtils.checkMaterialDialog(materialDialog);

                            //页面报错；给提示
                            if (apiException != null) {
                                ToastUtils.showShort(apiException.getDisplayMessage());
                            }

                        }
                    });

        } else {
            ToastUtils.showShort(StringUtils.getString(R.string.http_exception_network));
        }

    }

    //发送填写链接 到客户手机，发送完毕也要刷新列表
    private void gain_send_signature_links_to_customer() {

        clientPhone_upLoad = editViewPhoneEvaluate.getText().toString().trim();

        if (NetworkUtils.isConnected()) {

            HashMap<String, Object> map = new HashMap<>();
            map.put(Parameterkey.shopInfoId, mSession.getShopInfoId());//,
            map.put(Parameterkey.clientPhone, clientPhone_upLoad);//,客户手机号
            map.put(Parameterkey.clientType, clientType_upLoad);//,clientType 客户类型(0:个人;1:企业),默认是个人
            map.put(Parameterkey.archiveTypeId, archiveTypeId_upLoad);//档案的类型，是新车 还是二手车

            AddLogUpLoadInfo addLogUpLoadInfo = new AddLogUpLoadInfo();
            addLogUpLoadInfo.setActivity(mActivityInstance);
            addLogUpLoadInfo.setWhat(ConstantApi.WHAT_SENDOPENFASCAUTHURL_URL);//请求数字标识
            addLogUpLoadInfo.setUrlPath(ApiService.sendOpenFascAuthUrl_url);//url地址
            addLogUpLoadInfo.setRequestMethod(ConstantSign.REQUEST_METHOD_POST);//POST 或者 GET
            addLogUpLoadInfo.setToastToUser(false);//展示给用户的标志
            addLogUpLoadInfo.setHashMapParameter(map);

            NetworkManager.getInstance().initRetrofitRxJava()
                    .create(ApiService.class)
                    .sendOpenFascAuthUrl(RequestBody.create(JSON.toJSONString(map, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue),
                            MediaType.parse(ApiService.HEADER_JSON)))
                    .compose(SignatureDetailActivity.this.bindUntilEvent(ActivityEvent.DESTROY))//
                    .compose(new ResponseTransformer<>(addLogUpLoadInfo, new ApiRequestSubListener<SignatureWebInformationBean>() {
                        @Override
                        public void handlerSomeThingNotSuccessDataForItSelf(int what_method, String serverCode, String serverMessage) {
                            super.handlerSomeThingNotSuccessDataForItSelf(what_method, serverCode, serverMessage);

                            //{"data":"","message":"无更多数据","code":"29999"}
                            CommUtils.checkMaterialDialog(materialDialog);

                            //这里要不要给提示？无更多数据
                            if (!TextUtils.equals(serverCode, ConstantSign.RESPONSE_STRING_29999)) {

                                if (!TextUtils.isEmpty(serverMessage)) {
                                    ToastUtils.showShort(serverMessage);
                                }

                            } else {

                                CommUtils.checkDialog(mAlertView);
                                mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, serverMessage, true);
                                mAlertView.show();

                            }

                        }
                    })).doOnSubscribe(new Consumer<Disposable>() {
                        @Override
                        public void accept(Disposable disposable) throws Throwable {
                            //
                            method_create_materialDialog(mActivityInstance, ConstantSign.TIPS_SUBMIT);
                        }
                    }).subscribe(new Consumer<SignatureWebInformationBean>() {
                        @Override
                        public void accept(SignatureWebInformationBean signatureWebInformationBean) throws Throwable {


//                            {
//                                "code":"20000",
//                                    "data":{
//                                     "authUrl":"https://80000333.uat-e.fadada.com/authorizeui/person/login?authSerial=59e8e4a8223640659f64a056dbf3334a",
//                                        "informationId":3
//                            },
//                                "message":"success"
//                            }

                            CommUtils.checkMaterialDialog(materialDialog);

                            // TODO: 2023-10-26 18:25 存入本地 做接口携带用到；
                            //存入 informationId 的值内容；
                            String informationId = signatureWebInformationBean.getInformationId();
                            mSession.setInformationId(informationId);

                            //MMKV.defaultMMKV().encode(ConstantSign.P_INFORMATIONID, informationId);
                            String authUrl = signatureWebInformationBean.getAuthUrl();

                            if (!TextUtils.isEmpty(authUrl)) {
                                //提示发送成功或者失败：
                                PopTip.show(getResources().getString(R.string.send_links_to_customer)).iconSuccess();
                            }

                            method_refresh_detail();

                        }
                    }, new ErrorConsumer() {

                        @Override
                        protected void error(ApiException apiException) {

                            CommUtils.checkMaterialDialog(materialDialog);

                            //页面报错；给提示
                            if (apiException != null) {
                                ToastUtils.showShort(apiException.getDisplayMessage());
                            }

                        }
                    });

        } else {

            ToastUtils.showShort(StringUtils.getString(R.string.http_exception_network));

        }


    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onEventMainThreadEventRefresDetail(EventSignatureDetail eventSignatureDetail) {

        if (eventSignatureDetail != null) {

            if (eventSignatureDetail.getMessage() == ExtraValue.EVENTBUS_EVENT_TO_REFRESH_SIGNATURE_DETAIL) {

                //单步刷新 内部小列表；
                getServerDatas();

            }
        }
    }


    @Override
    protected void onDestroy() {
        super.onDestroy();

        //
        EventBus.getDefault().unregister(this);

    }

    @Override
    protected void methodBack() {

        methodBackFinish();

    }

    @Override
    public void processExtraData() {

        Bundle extras_bundle = this.getIntent().getExtras();

        if (extras_bundle != null) {

            extra_jumpfrom_where = extras_bundle.getInt(ExtraKey.EXTRA_JUMPFROM_WHERE);
            extra_fileSignatureManage = extras_bundle.getParcelable(ExtraKey.EXTRA_SIGNATRUE_MANAGE_ITEM_BEAN);

            if (extra_fileSignatureManage != null) {
                LogUtils.json(ConstantSign.LOGCAT_NOMAL + "携带的档案 列表有效信息是-内容是", extra_fileSignatureManage);
            }

        }

    }
}